diff --git a/lib/forever/monitor.js b/lib/forever/monitor.js index 74f000a8..9b2c9bd1 100644 --- a/lib/forever/monitor.js +++ b/lib/forever/monitor.js @@ -33,6 +33,7 @@ var Monitor = exports.Monitor = function (script, options) { options = options || {}; this.silent = options.silent || false; this.forever = options.forever || false; + this.killTree = options.killTree !== false; this.uid = options.uid || forever.randomString(24); this.pidFile = options.pidFile || path.join(forever.config.get('pidPath'), this.uid + '.pid'); this.max = options.max; @@ -373,13 +374,20 @@ Monitor.prototype.kill = function (forceStop) { if (forceStop) { this.forceStop = true; } - psTree(this.child.pid, function (err, children) { - var pids = children.map(function (p) { return p.PID }) - pids.shift(self.child.pid) - spawn('kill', ['-9'].concat(pids)).on('exit', function () { - self.emit('stop', self.childData); - }) - }) + + if (this.killTree) { + psTree(this.child.pid, function (err, children) { + var pids = children.map(function (p) { return p.PID }) + pids.shift(self.child.pid) + spawn('kill', ['-9'].concat(pids)).on('exit', function () { + self.emit('stop', self.childData); + }) + }); + } + else { + this.child.kill(); + this.emit('stop', this.childData); + } } diff --git a/package.json b/package.json index f4fcf9d4..1f380cad 100644 --- a/package.json +++ b/package.json @@ -32,15 +32,15 @@ "dnode": "0.8.x", "eyes": "0.1.x", "daemon": "0.3.x", + "minimatch": "0.0.x", "mkdirp": "0.x.x", "nconf": "0.x.x", "optimist": "0.2.x", "pkginfo": "0.x.x", "portfinder": "0.x.x", + "ps-tree": "0.0.x", "timespan": "2.0.x", "watch": "0.3.x", - "minimatch": "0.0.x", - "ps-tree": "0.0.x", "winston": "0.5.x" }, "devDependencies": {