diff --git a/build/.moduleignore b/build/.moduleignore index 56e2fb15718..abc37e3138c 100644 --- a/build/.moduleignore +++ b/build/.moduleignore @@ -37,6 +37,8 @@ fsevents/test/** @vscode/windows-process-tree/binding.gyp @vscode/windows-process-tree/build/** @vscode/windows-process-tree/src/** +@vscode/windows-process-tree/tsconfig.json +@vscode/windows-process-tree/tslint.json !@vscode/windows-process-tree/**/*.node @vscode/windows-registry/binding.gyp diff --git a/build/.moduleignore.darwin b/build/.moduleignore.darwin index fc3f48af069..dbc12762f7d 100644 --- a/build/.moduleignore.darwin +++ b/build/.moduleignore.darwin @@ -3,6 +3,12 @@ @vscode/windows-mutex/*.md @vscode/windows-mutex/package.json +@vscode/windows-process-tree/lib/** +@vscode/windows-process-tree/**/*.node +@vscode/windows-process-tree/LICENSE +@vscode/windows-process-tree/package.json +@vscode/windows-process-tree/*.md + @vscode/windows-registry/dist/** @vscode/windows-registry/**/*.node @vscode/windows-registry/*.md diff --git a/build/.moduleignore.linux b/build/.moduleignore.linux index fc3f48af069..dbc12762f7d 100644 --- a/build/.moduleignore.linux +++ b/build/.moduleignore.linux @@ -3,6 +3,12 @@ @vscode/windows-mutex/*.md @vscode/windows-mutex/package.json +@vscode/windows-process-tree/lib/** +@vscode/windows-process-tree/**/*.node +@vscode/windows-process-tree/LICENSE +@vscode/windows-process-tree/package.json +@vscode/windows-process-tree/*.md + @vscode/windows-registry/dist/** @vscode/windows-registry/**/*.node @vscode/windows-registry/*.md diff --git a/package.json b/package.json index f6c482987a7..84154f8aeb5 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "@vscode/sudo-prompt": "9.3.1", "@vscode/vscode-languagedetection": "1.0.21", "@vscode/windows-mutex": "^0.4.4", + "@vscode/windows-process-tree": "^0.5.0", "@vscode/windows-registry": "^1.1.0", "graceful-fs": "4.2.8", "http-proxy-agent": "^2.1.0", @@ -227,7 +228,6 @@ "url": "https://github.com/microsoft/vscode/issues" }, "optionalDependencies": { - "@vscode/windows-process-tree": "0.4.2", "windows-foreground-love": "0.5.0" } } diff --git a/remote/package.json b/remote/package.json index ffd7fb5e5d4..dcf21887900 100644 --- a/remote/package.json +++ b/remote/package.json @@ -11,6 +11,7 @@ "@vscode/ripgrep": "^1.15.4", "@vscode/spdlog": "^0.13.10", "@vscode/vscode-languagedetection": "1.0.21", + "@vscode/windows-process-tree": "^0.5.0", "@vscode/windows-registry": "^1.1.0", "cookie": "^0.4.0", "graceful-fs": "4.2.8", @@ -35,8 +36,5 @@ "xterm-headless": "5.3.0-beta.1", "yauzl": "^2.9.2", "yazl": "^2.4.3" - }, - "optionalDependencies": { - "@vscode/windows-process-tree": "0.4.2" } } diff --git a/remote/yarn.lock b/remote/yarn.lock index cfc9cb6c801..e85609c19b8 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -101,10 +101,10 @@ 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== +"@vscode/windows-process-tree@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@vscode/windows-process-tree/-/windows-process-tree-0.5.0.tgz#b8205b862c75a1e0ad8b7bf4350dc85036ee3a2c" + integrity sha512-y8Oliel/rBSYh9f1T4F0zQjJNPeJRgYRhEKZsjas7JXKLf46FpE3Ux8e9+7HelUD8dXFH7C7N6895nU0WhrMlg== dependencies: nan "^2.17.0" diff --git a/src/typings/windows-process-tree.d.ts b/src/typings/windows-process-tree.d.ts deleted file mode 100644 index a8708a6cccc..00000000000 --- a/src/typings/windows-process-tree.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 { } - - 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; - } - - /** - * 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; - } - - /** - * 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; - } -} diff --git a/src/vs/base/node/ps.ts b/src/vs/base/node/ps.ts index 5eb35eddc66..f61af2b8117 100644 --- a/src/vs/base/node/ps.ts +++ b/src/vs/base/node/ps.ts @@ -115,13 +115,13 @@ export function listProcesses(rootPid: number): Promise { const cleanUNCPrefix = (value: string): string => { if (value.indexOf('\\\\?\\') === 0) { - return value.substr(4); + return value.substring(4); } else if (value.indexOf('\\??\\') === 0) { - return value.substr(4); + return value.substring(4); } else if (value.indexOf('"\\\\?\\') === 0) { - return '"' + value.substr(5); + return '"' + value.substring(5); } else if (value.indexOf('"\\??\\') === 0) { - return '"' + value.substr(5); + return '"' + value.substring(5); } else { return value; } @@ -169,10 +169,7 @@ export function listProcesses(rootPid: number): Promise { reject(new Error(`Root process ${rootPid} not found`)); } }); - }, - // Workaround duplicate enum identifiers issue in @vscode/windows-process-tree - // Ref https://github.com/microsoft/vscode/pull/179508 - (windowsProcessTree.ProcessDataFlag as any).CommandLine | (windowsProcessTree.ProcessDataFlag as any).Memory); + }, windowsProcessTree.ProcessDataFlag.CommandLine | windowsProcessTree.ProcessDataFlag.Memory); }); } else { // OS X & Linux function calculateLinuxCpuUsage() { diff --git a/yarn.lock b/yarn.lock index a2146d5721a..2f3676a6211 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1400,10 +1400,10 @@ bindings "^1.2.1" nan "^2.17.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== +"@vscode/windows-process-tree@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@vscode/windows-process-tree/-/windows-process-tree-0.5.0.tgz#b8205b862c75a1e0ad8b7bf4350dc85036ee3a2c" + integrity sha512-y8Oliel/rBSYh9f1T4F0zQjJNPeJRgYRhEKZsjas7JXKLf46FpE3Ux8e9+7HelUD8dXFH7C7N6895nU0WhrMlg== dependencies: nan "^2.17.0"