Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump windows-process-tree #179176

Merged
merged 4 commits into from Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Expand Up @@ -222,6 +222,7 @@
"@vscode/iconv-lite-umd",
"@vscode/policy-watcher",
"@vscode/proxy-agent",
"@vscode/windows-process-tree",
"assert",
"child_process",
"console",
Expand Down Expand Up @@ -251,7 +252,6 @@
"v8-inspect-profiler",
"vscode-regexpp",
"vscode-textmate",
"windows-process-tree",
"worker_threads",
"xterm",
"xterm-addon-canvas",
Expand Down
10 changes: 5 additions & 5 deletions build/.moduleignore
Expand Up @@ -26,6 +26,11 @@ fsevents/test/**
@vscode/windows-mutex/src/**
!@vscode/windows-mutex/**/*.node

@vscode/windows-process-tree/binding.gyp
@vscode/windows-process-tree/build/**
@vscode/windows-process-tree/src/**
!@vscode/windows-process-tree/**/*.node

@vscode/windows-registry/binding.gyp
@vscode/windows-registry/src/**
@vscode/windows-registry/build/**
Expand Down Expand Up @@ -66,11 +71,6 @@ windows-foreground-love/build/**
windows-foreground-love/src/**
!windows-foreground-love/**/*.node

windows-process-tree/binding.gyp
windows-process-tree/build/**
windows-process-tree/src/**
!windows-process-tree/**/*.node

keytar/binding.gyp
keytar/build/**
keytar/src/**
Expand Down
5 changes: 2 additions & 3 deletions package.json
Expand Up @@ -120,7 +120,6 @@
"@types/webpack": "^5.28.1",
"@types/wicg-file-system-access": "^2020.9.5",
"@types/windows-foreground-love": "^0.3.0",
"@types/windows-process-tree": "^0.2.0",
"@types/winreg": "^1.2.30",
"@types/yauzl": "^2.9.1",
"@types/yazl": "^2.4.2",
Expand Down Expand Up @@ -225,9 +224,9 @@
},
"optionalDependencies": {
"@vscode/windows-mutex": "0.4.2",
"@vscode/windows-process-tree": "0.4.2",
"@vscode/windows-registry": "1.0.10",
"windows-foreground-love": "0.5.0",
"windows-process-tree": "0.4.0"
"windows-foreground-love": "0.5.0"
},
"resolutions": {
"elliptic": "^6.5.3",
Expand Down
4 changes: 2 additions & 2 deletions remote/package.json
Expand Up @@ -35,7 +35,7 @@
"yazl": "^2.4.3"
},
"optionalDependencies": {
"@vscode/windows-registry": "1.0.10",
"windows-process-tree": "0.4.0"
"@vscode/windows-process-tree": "0.4.2",
"@vscode/windows-registry": "1.0.10"
}
}
14 changes: 7 additions & 7 deletions remote/yarn.lock
Expand Up @@ -92,6 +92,13 @@
dependencies:
node-addon-api "^3.0.2"

"@vscode/windows-process-tree@0.4.2":
version "0.4.2"
resolved "https://registry.yarnpkg.com/@vscode/windows-process-tree/-/windows-process-tree-0.4.2.tgz#54d010fdeb06dfe3a9c6d58fcb3ed9acfc962f33"
integrity sha512-b20865s1HG1VtGt887KrB1blwFS6p4L1Fl1o/WplO9j7sGBle8sLqkNnGXbCaRNgdIgfXtitmzG366FVynJZdQ==
dependencies:
nan "^2.17.0"

"@vscode/windows-registry@1.0.10":
version "1.0.10"
resolved "https://registry.yarnpkg.com/@vscode/windows-registry/-/windows-registry-1.0.10.tgz#17e4e2f8fdd41990206d1bab2daf99c803206247"
Expand Down Expand Up @@ -824,13 +831,6 @@ wide-align@^1.1.0:
dependencies:
string-width "^1.0.2 || 2 || 3 || 4"

windows-process-tree@0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/windows-process-tree/-/windows-process-tree-0.4.0.tgz#31ac49c5da557e628ce7e37a5800972173d3349a"
integrity sha512-9LunDnc1WwuhyLeTAXMFX8wbActGJtDCBaiapQXFYk/nO4W4X9YxOKV5g/lQL3XX69QYxveDbjVVrdnTt1qqCQ==
dependencies:
nan "^2.17.0"

wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
Expand Down
79 changes: 79 additions & 0 deletions src/typings/windows-process-tree.d.ts
rzhao271 marked this conversation as resolved.
Show resolved Hide resolved
@@ -0,0 +1,79 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

// Copied from the `@vscode/windows-process-tree` package.
// The dependency is an optional dependency that is only used on Windows,
// but we need the typings to compile on all platforms.
// The `@types/windows-process-tree` package has also been deprecated.
declare module '@vscode/windows-process-tree' {
export enum ProcessDataFlag {
None = 0,
Memory = 1,
CommandLine = 2
}

export interface IProcessInfo {
pid: number;
ppid: number;
name: string;

/**
* The working set size of the process, in bytes.
*/
memory?: number;

/**
* The string returned is at most 512 chars, strings exceeding this length are truncated.
*/
commandLine?: string;
}

export interface IProcessCpuInfo extends IProcessInfo {
cpu?: number;
}

export interface IProcessTreeNode {
pid: number;
name: string;
memory?: number;
commandLine?: string;
children: IProcessTreeNode[];
}

/**
* Returns a tree of processes with the rootPid process as the root.
* @param rootPid - The pid of the process that will be the root of the tree.
* @param callback - The callback to use with the returned list of processes.
* @param flags - The flags for what process data should be included.
*/
export function getProcessTree(rootPid: number, callback: (tree: IProcessTreeNode | undefined) => void, flags?: ProcessDataFlag): void;

namespace getProcessTree {
function __promisify__(rootPid: number, flags?: ProcessDataFlag): Promise<IProcessTreeNode>;
}

/**
* Returns a list of processes containing the rootPid process and all of its descendants.
* @param rootPid - The pid of the process of interest.
* @param callback - The callback to use with the returned set of processes.
* @param flags - The flags for what process data should be included.
*/
export function getProcessList(rootPid: number, callback: (processList: IProcessInfo[] | undefined) => void, flags?: ProcessDataFlag): void;

namespace getProcessList {
function __promisify__(rootPid: number, flags?: ProcessDataFlag): Promise<IProcessInfo[]>;
}

/**
* Returns the list of processes annotated with cpu usage information.
* @param processList - The list of processes.
* @param callback - The callback to use with the returned list of processes.
*/
export function getProcessCpuUsage(processList: IProcessInfo[], callback: (processListWithCpu: IProcessCpuInfo[]) => void): void;

namespace getProcessCpuUsage {
function __promisify__(processList: IProcessInfo[]): Promise<IProcessCpuInfo[]>;
}
}
2 changes: 1 addition & 1 deletion src/vs/base/node/ps.ts
Expand Up @@ -127,7 +127,7 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
}
};

(import('windows-process-tree')).then(windowsProcessTree => {
(import('@vscode/windows-process-tree')).then(windowsProcessTree => {
windowsProcessTree.getProcessList(rootPid, (processList) => {
if (!processList) {
reject(new Error(`Root process ${rootPid} not found`));
Expand Down
Expand Up @@ -123,16 +123,16 @@ flakySuite('Native Modules (all platforms)', () => {
assert.ok(typeof result === 'boolean', testErrorMessage('windows-foreground-love'));
});

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

return new Promise((resolve, reject) => {
processTree.getProcessTree(process.pid, tree => {
if (tree) {
resolve();
} else {
reject(new Error(testErrorMessage('windows-process-tree')));
reject(new Error(testErrorMessage('@vscode/windows-process-tree')));
}
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/terminal/node/windowsShellHelper.ts
Expand Up @@ -9,7 +9,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { isWindows, platform } from 'vs/base/common/platform';
import { TerminalShellType, WindowsShellType } from 'vs/platform/terminal/common/terminal';
import type * as WindowsProcessTreeType from 'windows-process-tree';
import type * as WindowsProcessTreeType from '@vscode/windows-process-tree';

export interface IWindowsShellHelper extends IDisposable {
readonly onShellNameChanged: Event<string>;
Expand Down Expand Up @@ -129,7 +129,7 @@ export class WindowsShellHelper extends Disposable implements IWindowsShellHelpe
return this._currentRequest;
}
if (!windowsProcessTree) {
windowsProcessTree = await import('windows-process-tree');
windowsProcessTree = await import('@vscode/windows-process-tree');
}
this._currentRequest = new Promise<string>(resolve => {
windowsProcessTree.getProcessTree(this._rootProcessId, tree => {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/debug/node/terminals.ts
Expand Up @@ -30,7 +30,7 @@ export async function hasChildProcesses(processId: number | undefined): Promise<

// if shell has at least one child process, assume that shell is busy
if (platform.isWindows) {
const windowsProcessTree = await import('windows-process-tree');
const windowsProcessTree = await import('@vscode/windows-process-tree');
return new Promise<boolean>(resolve => {
windowsProcessTree.getProcessTree(processId, processTree => {
resolve(!!processTree && processTree.children.length > 0);
Expand Down
19 changes: 7 additions & 12 deletions yarn.lock
Expand Up @@ -1153,11 +1153,6 @@
resolved "https://registry.yarnpkg.com/@types/windows-foreground-love/-/windows-foreground-love-0.3.0.tgz#26bc230b2568aa7ab7c56d35bb5653c0a6965a42"
integrity sha512-tFUVA/fiofNqOh6lZlymvQiQYPY+cZXZPR9mn9wN6/KS8uwx0zgH4Ij/jmFyRYr+x+DGZWEIeknS2BMi7FZJAQ==

"@types/windows-process-tree@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@types/windows-process-tree/-/windows-process-tree-0.2.0.tgz#2fa205c838a8ef0a07697cd747c954653978d22c"
integrity sha512-vQAnkWpMX4HUPjubkxKta4Rfh2EDy2ksalnr37gFHNrmk+uxx50PRH+/fM5nTsEBCi4ESFT/7t7Za3jGqyTZ4g==

"@types/winreg@^1.2.30":
version "1.2.30"
resolved "https://registry.yarnpkg.com/@types/winreg/-/winreg-1.2.30.tgz#91d6710e536d345b9c9b017c574cf6a8da64c518"
Expand Down Expand Up @@ -1394,6 +1389,13 @@
bindings "^1.2.1"
nan "^2.14.0"

"@vscode/windows-process-tree@0.4.2":
version "0.4.2"
resolved "https://registry.yarnpkg.com/@vscode/windows-process-tree/-/windows-process-tree-0.4.2.tgz#54d010fdeb06dfe3a9c6d58fcb3ed9acfc962f33"
integrity sha512-b20865s1HG1VtGt887KrB1blwFS6p4L1Fl1o/WplO9j7sGBle8sLqkNnGXbCaRNgdIgfXtitmzG366FVynJZdQ==
dependencies:
nan "^2.17.0"

"@vscode/windows-registry@1.0.10":
version "1.0.10"
resolved "https://registry.yarnpkg.com/@vscode/windows-registry/-/windows-registry-1.0.10.tgz#17e4e2f8fdd41990206d1bab2daf99c803206247"
Expand Down Expand Up @@ -10602,13 +10604,6 @@ windows-foreground-love@0.5.0:
resolved "https://registry.yarnpkg.com/windows-foreground-love/-/windows-foreground-love-0.5.0.tgz#7672b04eb05f934a6543cacdc3cd16ff34e3cb10"
integrity sha512-yjBwmKEmQBDk3Z7yg/U9hizGWat8C6Pe4MQWl5bN6mvPU81Bt6HV2k/6mGlK3ETJLW1hCLhYx2wcGh+ykUUCyA==

windows-process-tree@0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/windows-process-tree/-/windows-process-tree-0.4.0.tgz#31ac49c5da557e628ce7e37a5800972173d3349a"
integrity sha512-9LunDnc1WwuhyLeTAXMFX8wbActGJtDCBaiapQXFYk/nO4W4X9YxOKV5g/lQL3XX69QYxveDbjVVrdnTt1qqCQ==
dependencies:
nan "^2.17.0"

word-wrap@^1.2.3, word-wrap@~1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
Expand Down