mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add types for windows-process-tree (#40259)
This commit is contained in:
parent
8169c6dbfe
commit
cf3e331667
61
types/windows-process-tree/index.d.ts
vendored
Normal file
61
types/windows-process-tree/index.d.ts
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
// Type definitions for windows-process-tree 0.2
|
||||
// Project: https://github.com/Microsoft/vscode-windows-process-tree
|
||||
// Definitions by: Rachel Macfarlane <https://github.com/DefinitelyTyped>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export enum ProcessDataFlag {
|
||||
None = 0,
|
||||
Memory = 1,
|
||||
CommandLine = 2
|
||||
}
|
||||
|
||||
export interface ProcessInfo {
|
||||
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 ProcessCpuInfo extends ProcessInfo {
|
||||
cpu?: number;
|
||||
}
|
||||
|
||||
export interface ProcessTreeNode {
|
||||
pid: number;
|
||||
name: string;
|
||||
memory?: number;
|
||||
commandLine?: string;
|
||||
children: ProcessTreeNode[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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: ProcessTreeNode) => void, flags?: ProcessDataFlag): void;
|
||||
|
||||
/**
|
||||
* 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: ProcessInfo[]) => void, flags?: ProcessDataFlag): void;
|
||||
|
||||
/**
|
||||
* 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: ReadonlyArray<ProcessInfo>, callback: (processListWithCpu: ProcessCpuInfo[]) => void): void;
|
||||
23
types/windows-process-tree/tsconfig.json
Normal file
23
types/windows-process-tree/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"windows-process-tree-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/windows-process-tree/tslint.json
Normal file
1
types/windows-process-tree/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
7
types/windows-process-tree/windows-process-tree-tests.ts
Normal file
7
types/windows-process-tree/windows-process-tree-tests.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import * as windowsProcessTree from "windows-process-tree";
|
||||
|
||||
windowsProcessTree.getProcessCpuUsage([], () => { });
|
||||
windowsProcessTree.getProcessList(1, () => { });
|
||||
windowsProcessTree.getProcessTree(1, () => { }, windowsProcessTree.ProcessDataFlag.CommandLine);
|
||||
windowsProcessTree.getProcessTree(1, () => { }, windowsProcessTree.ProcessDataFlag.Memory);
|
||||
windowsProcessTree.getProcessTree(1, () => { }, windowsProcessTree.ProcessDataFlag.None);
|
||||
Loading…
Reference in New Issue
Block a user