Skip to content

Commit

Permalink
[refactor] Update to forever-monitor@1.4.0 and do not use the depre…
Browse files Browse the repository at this point in the history
…cated `.options` option. You can see why it is deprecated.
  • Loading branch information
indexzero committed Oct 30, 2014
1 parent 73359e8 commit 283f210
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ forever.columns = {
script: {
color: 'grey',
get: function (proc) {
return [proc.file].concat(proc.options).join(' ').grey;
return [proc.file].concat(proc.args).join(' ').grey;
}
},
forever: {
Expand Down
2 changes: 1 addition & 1 deletion lib/forever/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ var getOptions = cli.getOptions = function (file) {
//
// First isolate options which should be passed to file
//
options.options = process.argv.splice(process.argv.indexOf(file) + 1);
options.args = process.argv.splice(process.argv.indexOf(file) + 1);

//
// Now we have to force optimist to reparse command line options because
Expand Down
18 changes: 9 additions & 9 deletions lib/forever/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ Worker.prototype.start = function (callback) {
if (callback) {
return callback(err);
}

throw err;
}
}

//
// Defines a simple `nssocket` protocol for communication
Expand Down Expand Up @@ -57,7 +57,7 @@ Worker.prototype.start = function (callback) {
return socket.send(['spawn', 'error'], { error: new Error("Already running") });
}

var monitor = new (forever.Monitor)(data.script, data.options);
var monitor = new (forever.Monitor)(data.script, data.args);
monitor.start();

monitor.on('start', function () {
Expand All @@ -70,15 +70,15 @@ Worker.prototype.start = function (callback) {
socket.send(['stop', 'ok']);
self.exitOnStop && process.exit();
});

self.monitor.stop();
});

socket.data(['restart'], function () {
self.monitor.once('restart', function () {
socket.send(['restart', 'ok']);
});

self.monitor.restart();
});
}
Expand All @@ -100,7 +100,7 @@ Worker.prototype.start = function (callback) {

callback && callback(err);
});

//
// Create a unique socket file based on the current microtime.
//
Expand All @@ -109,10 +109,10 @@ Worker.prototype.start = function (callback) {
new Date().getTime() + utile.randomString(3),
'sock'
].join('.'));

self._socket.listen(sock);
}

//
// Attempt to start the server the first time
//
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"colors": "~0.6.2",
"cliff": "0.1.8",
"flatiron": "~0.3.11",
"forever-monitor": "1.3.0",
"forever-monitor": "1.4.0",
"nconf": "~0.6.9",
"nssocket": "~0.5.1",
"optimist": "~0.6.0",
Expand Down
12 changes: 6 additions & 6 deletions test/worker/multiple-workers-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,26 @@ vows.describe('forever/workers/multiple').addBatch({
children[0] = new (forever.Monitor)(script, {
silent: true,
maxRestart: 1,
options: [ "--port=8080"]
args: [ "--port=8080"]
});

children[1] = new (forever.Monitor)(script, {
silent: true,
maxRestart: 1,
options: [ "--port=8081"]
args: [ "--port=8081"]
});

children[0].on('start', function () {
children[1].on('start', function () {
pids = children.map(function (child) {
return child.child.pid;
});

setTimeout(function () {
forever.startServer(children[0], children[1], that.callback);
}, 1000);
});

children[1].start();
});

Expand Down

0 comments on commit 283f210

Please sign in to comment.