-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathwindowsProcessTree.ts
More file actions
50 lines (42 loc) · 1.85 KB
/
windowsProcessTree.ts
File metadata and controls
50 lines (42 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from '../localize';
import { getCoreNodeModule } from "./getCoreNodeModule";
export function getWindowsProcessTree(): IWindowsProcessTree {
const moduleName: string = '@vscode/windows-process-tree';
const windowsProcessTree: IWindowsProcessTree | undefined = getCoreNodeModule<IWindowsProcessTree>(moduleName);
if (!windowsProcessTree) {
throw new Error(localize('noWindowsProcessTree', 'Failed to find dependency "{0}".', moduleName));
}
return windowsProcessTree;
}
// https://github.com/microsoft/vscode-windows-process-tree/blob/b7efc9fb4567d552ef95c7449058b6f634a82df8/typings/windows-process-tree.d.ts
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 IWindowsProcessTree {
/**
* 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.
*/
getProcessList(rootPid: number, callback: (processList: IProcessInfo[]) => void, flags?: ProcessDataFlag): void;
}