Due to wmic has been deprecated. Use @vscode/windows-process-tree for Windows process listing with WMIC fallback#991
Due to wmic has been deprecated. Use @vscode/windows-process-tree for Windows process listing with WMIC fallback#991ZA139 wants to merge 7 commits intomicrosoft:mainfrom
Conversation
Add @vscode/windows-process-tree as a dependency and use it on Windows to enumerate processes (via promisified getAllProcesses). Fall back to the existing WMIC parser when windows-process-tree is unavailable. Update provider logic to return parsed process items from the native API on Windows and keep PS-based listing for macOS/Linux. Update unit tests to stub and exercise the new getAllProcesses flow and the WMIC fallback, and add webpack externals entry for the new native module.
Adjust Windows process provider unit tests to match the updated getAllProcesses API that accepts a flag parameter and uses an error-first callback. Stubs now use signatures like (_flag, callback) and call callback(null, processList); throwing stubs were updated to accept two arguments. These are test-only updates to align with the new function signature.
Replace use of util.promisify with an explicit Promise wrapper around wpc.getAllProcesses, removing the promisify import and adapting the call site to resolve with the process list. Update unit tests to match the changed callback shape (stubs now call callback(processList) and throw without an error-first parameter). This keeps Windows process enumeration working while aligning with the windows-process-tree callback behavior.
Integrate windows-process-tree for Windows process enumeration
|
Hi,@eleanorjboyd @Tyriar Sorry for the delay! Best Regards |
Static imports can cause the entire module to fail if the native plugin's ABI doesn't match the running Node version. Using dynamic `require()` within a `try-catch` statement allows for a fallback to WMIC if the module is unavailable or incompatible. To ensure compile-time type safety, only type imports are retained. Add a comment to webpack externals explaining why the native addon must be excluded from bundling.
|
Looks like a linting error: /home/runner/work/vscode-python-debugger/vscode-python-debugger/src/test/unittest/common/environment.unit.test.ts You'll likely have to add an ignore for those. |
Replace single-line eslint-disable-next-line comments with explicit block disables/enables around the assertions in src/test/unittest/common/environment.unit.test.ts. This silences @typescript-eslint/naming-convention for the expected object literals (e.g. VAR1/VAR2) while keeping the rule enabled elsewhere.
Thanks for pointing that out. Those linting errors were introduced by the previous commit 7253c44, so I didn't fix them earlier. I've just pushed a fix to resolve them. |
Reformat long function calls in AttachProcessProvider for improved readability. Split arguments for wpc.getAllProcesses and logProcess into multiple lines (with trailing commas); no functional changes.
Following up on #858, which replaced WMIC with PowerShell for process listing, this PR takes a different approach by using the native @vscode/windows-process-tree module (getAllProcesses) to enumerate processes on Windows. This avoids spawning external commands entirely and provides better performance.
Changes:
Test changes:
No feature changed. This is an internal improvement to process enumeration reliability on Windows.