forked from UmbraEngineering/ps
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
I have two nginx executables running.
C:/nginx/nginx.exe(or sayusr/bin)C:/second/nginx/nginx.exe(or say$home/local/nginx)
I wish to get the executable's path of the running nginx file whether it is the first or second. I am aware of this command wmic process where "ExecutablePath like 'c:\\nginx\\nginx%'" get ProcessID in windows. Is there a way I can do it using ps-node so it applies to both linux and win?
var ps = require('ps-node');
ps.lookup({
command: 'nginx',
psargs: 'ux'
}, function(err, resultList ) {
if (err) {
throw new Error( err );
}
resultList.forEach(function( process ){
if( process ){
console.log(process.pid, process.command, **process.ExecutablePath**, process.arguments );
// **process.ExecutablePath** => c:/nginx or usr/bin
}
});
});
Metadata
Metadata
Assignees
Labels
No labels