From 1b07b1ea99eec0263d4ecfad8dfa619a9c4f825b Mon Sep 17 00:00:00 2001 From: Dain Date: Wed, 18 Jan 2017 13:49:08 -0700 Subject: [PATCH] Add support for windows parent process ID --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 24e36e5..8c86a85 100644 --- a/lib/index.js +++ b/lib/index.js @@ -67,7 +67,7 @@ var Exec = module.exports = exports = function (args, callback) { callback(stderr, stdout.join(SystemEOL) || false); }); - CMD.stdin.write('wmic process get ProcessId,CommandLine \n'); + CMD.stdin.write('wmic process get ProcessId,ParentProcessId,CommandLine \n'); CMD.stdin.end(); } else { @@ -235,7 +235,7 @@ function formatOutput(data) { data.forEach(function (d) { var pid = ( d.PID && d.PID[0] ) || ( d.ProcessId && d.ProcessId[0] ) || undefined; var cmd = d.CMD || d.CommandLine || d.COMMAND || undefined; - var ppid = ( d.PPID && d.PPID[0] ) || undefined; + var ppid = ( d.PPID && d.PPID[0] ) || ( d.ParentProcessId && d.ParentProcessId[0] ) || undefined; if (pid && cmd) { var command = cmd[0];