Commit dde634d
authored
Due to wmic has been deprecated. Use @vscode/windows-process-tree for Windows process listing with WMIC fallback (#991)
* Use windows-process-tree on Windows for process listing
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.
* Update tests for getAllProcesses signature
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.
* Wrap wpc.getAllProcesses in a Promise
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.
* Switch windows-process-tree from static import to dynamic require
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.
* Use block eslint-disable for naming-convention in tests
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.
* Format process-related calls for readability
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.1 parent 421eabb commit dde634d
6 files changed
Lines changed: 286 additions & 36 deletions
File tree
- src
- extension/debugger/attachQuickPick
- test/unittest
- attachQuickPick
- common
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
| 690 | + | |
690 | 691 | | |
691 | 692 | | |
692 | 693 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
63 | 97 | | |
64 | 98 | | |
65 | 99 | | |
66 | 100 | | |
67 | | - | |
68 | | - | |
69 | 101 | | |
70 | 102 | | |
71 | 103 | | |
72 | 104 | | |
73 | 105 | | |
74 | 106 | | |
75 | 107 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 108 | + | |
80 | 109 | | |
81 | 110 | | |
0 commit comments