Skip to content

Commit

Permalink
[fix] Reset system store before reparsing argv
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki authored and indexzero committed Nov 23, 2011
1 parent 736fecb commit d6b6c58
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions lib/forever/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,24 @@ function checkColumn(name) {
// `forever.startDaemon`
//
function getOptions(file) {
var options = {},
o = [
'pidFile', 'logFile', 'errFile', 'watch', 'minUptime', 'appendLog',
'silent', 'max', 'command', 'path', 'spinSleepTime', 'sourceDir',
'uid'
];
o.forEach(function (key) {
var options = {};
//
// First isolate options which should be passed to file
//
options.options = process.argv.splice(process.argv.indexOf(file) + 1);

//
// Now we have to force optimist to reparse command line options because
// we've removed some before.
//
app.config.system.reset();
app.config.system.loadSync();

[
'pidFile', 'logFile', 'errFile', 'watch', 'minUptime', 'appendLog',
'silent', 'max', 'command', 'path', 'spinSleepTime', 'sourceDir',
'uid'
].forEach(function (key) {
options[key] = app.config.get(key);
});

Expand Down

0 comments on commit d6b6c58

Please sign in to comment.