Skip to content

feat:Add getAllProcesses API for retrieving all system processes#84

Open
ZA139 wants to merge 3 commits intomicrosoft:mainfrom
ZA139:main
Open

feat:Add getAllProcesses API for retrieving all system processes#84
ZA139 wants to merge 3 commits intomicrosoft:mainfrom
ZA139:main

Conversation

@ZA139
Copy link

@ZA139 ZA139 commented Jan 21, 2026

Add getAllProcesses API for retrieving all system processes

📝 Description

This PR introduces a new getAllProcesses() API to retrieve a comprehensive list of all processes currently running on the Windows system, complementing the existing process-related APIs.

✨ Changes

Core Implementation

  • New API: getAllProcesses()
    • Retrieves a list of all processes on the system
    • Supports both callback and Promise-based interfaces
    • Supports optional flags for additional data (Memory, CommandLine)
    • Windows-only implementation with proper platform checks

Files Changed

  1. lib/index.ts - Core implementation with promisify support

    • Added getAllProcesses() function
    • Added namespace with __promisify__() for Promise support
    • Registered function with promisify.custom symbol
  2. lib/promises.ts - Promise wrapper

    • Exported promisified version for async/await usage
  3. lib/test.ts - Comprehensive test suite

    • 5 new test cases covering:
      • Native method functionality
      • Callback API interface
      • Promise-based interface
      • Memory flag support
      • CommandLine flag support
  4. typings/windows-process-tree.d.ts - Type definitions

    • Added callback-style function signature
    • Added promisify namespace declaration
    • Fixed documentation (set → list)
  5. typings/windows-process-tree/promises.d.ts - Promise type definitions

    • Added Promise-based function signature

🎯 Motivation

Background

WMIC is deprecated in Windows 10 (21H1+) and Windows Server 2022+, breaking the Python debugger's attach-to-process functionality.

Solution Strategy

The Python debugger is transitioning from shelling out to external tools (PowerShell/WMIC) to using the native vscode-windows-process-tree package for:

  • ✅ Better performance (no subprocess overhead)
  • ✅ More reliability (no CLI tool dependencies)
  • ✅ Cleaner maintenance

Why getAllProcesses()?

The existing getProcessList(rootPid) requires a root PID parameter. For the Python debugger's process picker, we need to enumerate all processes without PID filtering. This new API fills that gap.

🔗 Related Issues

🧪 Testing

All tests passing ✅

©Copyright

// This PR description was compiled by AI
// No programmers were harmed in the making of this description

ZA139 and others added 3 commits January 20, 2026 20:34
Introduces the getAllProcesses function to retrieve a list of all processes on Windows systems, with both callback and Promise-based interfaces. Updates typings to reflect the new API.
Introduces the getAllProcesses function to the promises module, updates type definitions, and adds unit tests to verify its behavior and flag support.
Corrected spacing in array declaration in index.ts, added missing newline in promises.ts and typings, and clarified the test description for getAllProcesses to specify use of the native API.
@ZA139
Copy link
Author

ZA139 commented Jan 29, 2026

@rzhao271 @Tyriar PTAL 🙏

This PR adds the getAllProcesses() API that resolves #28 and enables the Python debugger's migration away from deprecated WMIC.

Ready for your review when you have time!

@rzhao271 rzhao271 added this to the February 2026 milestone Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants