Fixes https://github.com/microsoft/vscode/issues/179697
This commit is contained in:
Raymond Zhao 2023-06-12 11:36:56 -07:00 коммит произвёл GitHub
Родитель bfe6dcb6f3
Коммит 13e7d80fcd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 29 добавлений и 95 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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"
}
}

Просмотреть файл

@ -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"
}
}

Просмотреть файл

@ -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"

75
src/typings/windows-process-tree.d.ts поставляемый
Просмотреть файл

@ -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<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[]>;
}
}

Просмотреть файл

@ -115,13 +115,13 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
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<ProcessItem> {
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() {

Просмотреть файл

@ -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"