Skip to content

Commit

Permalink
Replacing exec(kill) with process.kill. Thanks @visionmedia.
Browse files Browse the repository at this point in the history
  • Loading branch information
vesln committed Jan 12, 2012
1 parent 8bb8b27 commit d4a4458
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/watcher.js
Expand Up @@ -154,9 +154,13 @@ Watcher.prototype.notify = function(pid, state) {
*/
Watcher.prototype.check = function(pid, cb) {
this.parse(pid, function(p) {
exec('kill -0 ' + p, function(error, stdout, stderr) {
cb(!(stderr));
});
var result = false;
try {
if (p && !process.kill(p, 0)) result = true;
} catch (err) {
result = false;
}
cb(result);
});
};

Expand Down

0 comments on commit d4a4458

Please sign in to comment.