Skip to content

Commit

Permalink
[api] kill action for Worker
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Dec 11, 2011
1 parent 6517f74 commit a0d09d2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/forever/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var Worker = exports.Worker = function (options) {

this.monitor = options.monitor;
this.sockPath = options.sockPath || forever.config.get('sockPath');
this.exitOnKill = options.exitOnKill === true;

this._socket = null;
};
Expand Down Expand Up @@ -61,6 +62,14 @@ Worker.prototype.start = function (cb) {
socket.send(['spawn', 'start']);
});
});

socket.data(['kill'], function () {
self.monitor.on('stop', function () {
socket.send(['kill', 'stop']);
this.exitOnKill && process.exit();
});
self.monitor.kill();
});
});

findSocket(self.sockPath, function (err, sock) {
Expand Down

0 comments on commit a0d09d2

Please sign in to comment.