Skip to content

Commit

Permalink
file array case shortcut to set the command and options
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Dec 22, 2010
1 parent 02de53f commit 761b31b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,18 @@ function getAllPids (processes) {
var Forever = function (file, options) {
events.EventEmitter.call(this);

options.options.unshift(file);
options.silent = options.silent || false;
options.forever = options.forever || false;
options.command = options.command || 'node';

if (Array.isArray(file)) {
options.command = file[0];
options.options = file.slice(1);
}
else {
options.options.unshift(file);
}

// If we should log stdout, open a file buffer
if (options.outFile) {
this.stdout = fs.createWriteStream(options.outFile, { flags: 'a+', encoding: 'utf8', mode: 0666 });
Expand Down

0 comments on commit 761b31b

Please sign in to comment.