node-ps-promise
node-ps-promise is ps tool wrapper implementing promises.
node-ps-promise wraps neekey's node-ps-promise library
Installation
Install with npm.
npm install node-ps-promise
or Clone from github
git clone http://github.com/sgen/node-ps-promise
Usage
For full usage see neekey's ps-node library. lookup
and kill
function identically with the exception of the replacement of the callbacks with promises;
Lookup a process
var ps = require('ps-promise'); ps.lookup({ pid: 123}).then(function(results) { for (i = 0; i < results.length; i++) { console.log('Result %s: %s', i, results[i]) }}).catch(function(err) { console.error(err);});
Kill a process
var ps = require('ps-promise'); ps.kill(123).then(function(pid) { console.log(pid);}).catch(function(err) { console.error(err);});