Skip to content

Commit 15cb6b3

Browse files
authored
Bump windows-process-tree (#179176)
* Bump windows-process-tree * Fix compile error * Add explanation to source * Add that the types package has been deprecated
1 parent ff55375 commit 15cb6b3

File tree

11 files changed

+111
-38
lines changed

11 files changed

+111
-38
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
"@vscode/iconv-lite-umd",
223223
"@vscode/policy-watcher",
224224
"@vscode/proxy-agent",
225+
"@vscode/windows-process-tree",
225226
"assert",
226227
"child_process",
227228
"console",
@@ -251,7 +252,6 @@
251252
"v8-inspect-profiler",
252253
"vscode-regexpp",
253254
"vscode-textmate",
254-
"windows-process-tree",
255255
"worker_threads",
256256
"xterm",
257257
"xterm-addon-canvas",

build/.moduleignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ fsevents/test/**
2626
@vscode/windows-mutex/src/**
2727
!@vscode/windows-mutex/**/*.node
2828

29+
@vscode/windows-process-tree/binding.gyp
30+
@vscode/windows-process-tree/build/**
31+
@vscode/windows-process-tree/src/**
32+
!@vscode/windows-process-tree/**/*.node
33+
2934
@vscode/windows-registry/binding.gyp
3035
@vscode/windows-registry/src/**
3136
@vscode/windows-registry/build/**
@@ -66,11 +71,6 @@ windows-foreground-love/build/**
6671
windows-foreground-love/src/**
6772
!windows-foreground-love/**/*.node
6873

69-
windows-process-tree/binding.gyp
70-
windows-process-tree/build/**
71-
windows-process-tree/src/**
72-
!windows-process-tree/**/*.node
73-
7474
keytar/binding.gyp
7575
keytar/build/**
7676
keytar/src/**

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@
120120
"@types/webpack": "^5.28.1",
121121
"@types/wicg-file-system-access": "^2020.9.5",
122122
"@types/windows-foreground-love": "^0.3.0",
123-
"@types/windows-process-tree": "^0.2.0",
124123
"@types/winreg": "^1.2.30",
125124
"@types/yauzl": "^2.9.1",
126125
"@types/yazl": "^2.4.2",
@@ -225,9 +224,9 @@
225224
},
226225
"optionalDependencies": {
227226
"@vscode/windows-mutex": "0.4.2",
227+
"@vscode/windows-process-tree": "0.4.2",
228228
"@vscode/windows-registry": "1.0.10",
229-
"windows-foreground-love": "0.5.0",
230-
"windows-process-tree": "0.4.0"
229+
"windows-foreground-love": "0.5.0"
231230
},
232231
"resolutions": {
233232
"elliptic": "^6.5.3",

remote/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"yazl": "^2.4.3"
3636
},
3737
"optionalDependencies": {
38-
"@vscode/windows-registry": "1.0.10",
39-
"windows-process-tree": "0.4.0"
38+
"@vscode/windows-process-tree": "0.4.2",
39+
"@vscode/windows-registry": "1.0.10"
4040
}
4141
}

remote/yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@
9292
dependencies:
9393
node-addon-api "^3.0.2"
9494

95+
"@vscode/windows-process-tree@0.4.2":
96+
version "0.4.2"
97+
resolved "https://registry.yarnpkg.com/@vscode/windows-process-tree/-/windows-process-tree-0.4.2.tgz#54d010fdeb06dfe3a9c6d58fcb3ed9acfc962f33"
98+
integrity sha512-b20865s1HG1VtGt887KrB1blwFS6p4L1Fl1o/WplO9j7sGBle8sLqkNnGXbCaRNgdIgfXtitmzG366FVynJZdQ==
99+
dependencies:
100+
nan "^2.17.0"
101+
95102
"@vscode/windows-registry@1.0.10":
96103
version "1.0.10"
97104
resolved "https://registry.yarnpkg.com/@vscode/windows-registry/-/windows-registry-1.0.10.tgz#17e4e2f8fdd41990206d1bab2daf99c803206247"
@@ -824,13 +831,6 @@ wide-align@^1.1.0:
824831
dependencies:
825832
string-width "^1.0.2 || 2 || 3 || 4"
826833

827-
windows-process-tree@0.4.0:
828-
version "0.4.0"
829-
resolved "https://registry.yarnpkg.com/windows-process-tree/-/windows-process-tree-0.4.0.tgz#31ac49c5da557e628ce7e37a5800972173d3349a"
830-
integrity sha512-9LunDnc1WwuhyLeTAXMFX8wbActGJtDCBaiapQXFYk/nO4W4X9YxOKV5g/lQL3XX69QYxveDbjVVrdnTt1qqCQ==
831-
dependencies:
832-
nan "^2.17.0"
833-
834834
wrappy@1:
835835
version "1.0.2"
836836
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
// Copied from the `@vscode/windows-process-tree` package.
7+
// The dependency is an optional dependency that is only used on Windows,
8+
// but we need the typings to compile on all platforms.
9+
// The `@types/windows-process-tree` package has also been deprecated.
10+
declare module '@vscode/windows-process-tree' {
11+
export enum ProcessDataFlag {
12+
None = 0,
13+
Memory = 1,
14+
CommandLine = 2
15+
}
16+
17+
export interface IProcessInfo {
18+
pid: number;
19+
ppid: number;
20+
name: string;
21+
22+
/**
23+
* The working set size of the process, in bytes.
24+
*/
25+
memory?: number;
26+
27+
/**
28+
* The string returned is at most 512 chars, strings exceeding this length are truncated.
29+
*/
30+
commandLine?: string;
31+
}
32+
33+
export interface IProcessCpuInfo extends IProcessInfo {
34+
cpu?: number;
35+
}
36+
37+
export interface IProcessTreeNode {
38+
pid: number;
39+
name: string;
40+
memory?: number;
41+
commandLine?: string;
42+
children: IProcessTreeNode[];
43+
}
44+
45+
/**
46+
* Returns a tree of processes with the rootPid process as the root.
47+
* @param rootPid - The pid of the process that will be the root of the tree.
48+
* @param callback - The callback to use with the returned list of processes.
49+
* @param flags - The flags for what process data should be included.
50+
*/
51+
export function getProcessTree(rootPid: number, callback: (tree: IProcessTreeNode | undefined) => void, flags?: ProcessDataFlag): void;
52+
53+
namespace getProcessTree {
54+
function __promisify__(rootPid: number, flags?: ProcessDataFlag): Promise<IProcessTreeNode>;
55+
}
56+
57+
/**
58+
* Returns a list of processes containing the rootPid process and all of its descendants.
59+
* @param rootPid - The pid of the process of interest.
60+
* @param callback - The callback to use with the returned set of processes.
61+
* @param flags - The flags for what process data should be included.
62+
*/
63+
export function getProcessList(rootPid: number, callback: (processList: IProcessInfo[] | undefined) => void, flags?: ProcessDataFlag): void;
64+
65+
namespace getProcessList {
66+
function __promisify__(rootPid: number, flags?: ProcessDataFlag): Promise<IProcessInfo[]>;
67+
}
68+
69+
/**
70+
* Returns the list of processes annotated with cpu usage information.
71+
* @param processList - The list of processes.
72+
* @param callback - The callback to use with the returned list of processes.
73+
*/
74+
export function getProcessCpuUsage(processList: IProcessInfo[], callback: (processListWithCpu: IProcessCpuInfo[]) => void): void;
75+
76+
namespace getProcessCpuUsage {
77+
function __promisify__(processList: IProcessInfo[]): Promise<IProcessCpuInfo[]>;
78+
}
79+
}

src/vs/base/node/ps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
127127
}
128128
};
129129

130-
(import('windows-process-tree')).then(windowsProcessTree => {
130+
(import('@vscode/windows-process-tree')).then(windowsProcessTree => {
131131
windowsProcessTree.getProcessList(rootPid, (processList) => {
132132
if (!processList) {
133133
reject(new Error(`Root process ${rootPid} not found`));

src/vs/platform/environment/test/node/nativeModules.integrationTest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ flakySuite('Native Modules (all platforms)', () => {
123123
assert.ok(typeof result === 'boolean', testErrorMessage('windows-foreground-love'));
124124
});
125125

126-
test('windows-process-tree', async () => {
127-
const processTree = await import('windows-process-tree');
128-
assert.ok(typeof processTree.getProcessTree === 'function', testErrorMessage('windows-process-tree'));
126+
test('@vscode/windows-process-tree', async () => {
127+
const processTree = await import('@vscode/windows-process-tree');
128+
assert.ok(typeof processTree.getProcessTree === 'function', testErrorMessage('@vscode/windows-process-tree'));
129129

130130
return new Promise((resolve, reject) => {
131131
processTree.getProcessTree(process.pid, tree => {
132132
if (tree) {
133133
resolve();
134134
} else {
135-
reject(new Error(testErrorMessage('windows-process-tree')));
135+
reject(new Error(testErrorMessage('@vscode/windows-process-tree')));
136136
}
137137
});
138138
});

src/vs/platform/terminal/node/windowsShellHelper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Emitter, Event } from 'vs/base/common/event';
99
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
1010
import { isWindows, platform } from 'vs/base/common/platform';
1111
import { TerminalShellType, WindowsShellType } from 'vs/platform/terminal/common/terminal';
12-
import type * as WindowsProcessTreeType from 'windows-process-tree';
12+
import type * as WindowsProcessTreeType from '@vscode/windows-process-tree';
1313

1414
export interface IWindowsShellHelper extends IDisposable {
1515
readonly onShellNameChanged: Event<string>;
@@ -129,7 +129,7 @@ export class WindowsShellHelper extends Disposable implements IWindowsShellHelpe
129129
return this._currentRequest;
130130
}
131131
if (!windowsProcessTree) {
132-
windowsProcessTree = await import('windows-process-tree');
132+
windowsProcessTree = await import('@vscode/windows-process-tree');
133133
}
134134
this._currentRequest = new Promise<string>(resolve => {
135135
windowsProcessTree.getProcessTree(this._rootProcessId, tree => {

src/vs/workbench/contrib/debug/node/terminals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function hasChildProcesses(processId: number | undefined): Promise<
3030

3131
// if shell has at least one child process, assume that shell is busy
3232
if (platform.isWindows) {
33-
const windowsProcessTree = await import('windows-process-tree');
33+
const windowsProcessTree = await import('@vscode/windows-process-tree');
3434
return new Promise<boolean>(resolve => {
3535
windowsProcessTree.getProcessTree(processId, processTree => {
3636
resolve(!!processTree && processTree.children.length > 0);

0 commit comments

Comments
 (0)