Skip to content

Commit

Permalink
[refactor] Implement pass-through options for child
Browse files Browse the repository at this point in the history
Depends on indexzero/nconf#17.
  • Loading branch information
mmalecki authored and indexzero committed Nov 23, 2011
1 parent b30316e commit 8abe38d
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions lib/forever/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,31 @@ function checkColumn(name) {
//
function getOptions(file) {
var options = {};
options.pidFile = app.config.get('pidFile');
options.logFile = app.config.get('logFile');
//
// 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.loadArgv();

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

options.sourceDir = file && file[0] !== '/' ? process.cwd() : '/';
if (options.sourceDir) {
options.spawnWith = {cwd: options.sourceDir};
}

return options;
}

Expand Down

0 comments on commit 8abe38d

Please sign in to comment.