Update windows-process-tree version to 0.2.0

This commit is contained in:
Rachel Macfarlane 2018-03-26 10:53:38 -07:00
parent b638f1ad1b
commit d2d9d65efc
4 changed files with 58 additions and 11 deletions

View file

@ -132,6 +132,6 @@
"optionalDependencies": {
"windows-foreground-love": "0.1.0",
"windows-mutex": "^0.2.0",
"windows-process-tree": "0.1.6"
"windows-process-tree": "0.2.0"
}
}

View file

@ -4,13 +4,60 @@
*--------------------------------------------------------------------------------------------*/
declare module 'windows-process-tree' {
interface ProcessTreeNode {
pid: number,
name: string,
children: ProcessTreeNode[]
export enum ProcessDataFlag {
None = 0,
Memory = 1,
CommandLine = 2
}
function get(rootPid: number, callback: (tree: ProcessTreeNode) => void): void;
export interface IProcessInfo {
pid: number;
ppid: number;
name: string;
export = get;
/**
* 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) => 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: IProcessInfo[]) => 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: IProcessInfo[], callback: (processListWithCpu: IProcessCpuInfo[]) => void): void;
}

View file

@ -115,7 +115,7 @@ export class WindowsShellHelper {
return this._currentRequest;
}
this._currentRequest = new TPromise<string>(resolve => {
windowsProcessTree(this._rootProcessId, (tree) => {
windowsProcessTree.getProcessTree(this._rootProcessId, (tree) => {
const name = this.traverseTree(tree);
this._currentRequest = null;
resolve(name);

View file

@ -5969,9 +5969,9 @@ windows-mutex@^0.2.0:
bindings "^1.2.1"
nan "^2.1.0"
windows-process-tree@0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/windows-process-tree/-/windows-process-tree-0.1.6.tgz#c2d942a944152ea749a4c1c0bdb769b2f570639f"
windows-process-tree@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/windows-process-tree/-/windows-process-tree-0.2.0.tgz#04dc0507df292a7984daf0d35861bd1ebaff7ae8"
dependencies:
nan "^2.6.2"