Skip to content

Commit

Permalink
[fix] s/appendLog/append/g to make --append work.
Browse files Browse the repository at this point in the history
  • Loading branch information
AvianFlu committed Mar 2, 2012
1 parent 298ec73 commit dd1508b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/forever/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var argvOptions = cli.argvOptions = {
'command': {alias: 'c'},
'errFile': {alias: 'e'},
'logFile': {alias: 'l'},
'appendLog': {alias: ['a', 'append'], boolean: true},
'append': {alias: ['a', 'append'], boolean: true},
'max': {alias: 'm'},
'outFile': {alias: 'o'},
'path': {alias: 'p'},
Expand Down Expand Up @@ -125,7 +125,7 @@ function tryStart(file, options, callback) {
fullLog = forever.logFilePath(options.logFile, options.uid);
fullScript = path.join(options.sourceDir, file);

forever.stat(fullLog, fullScript, options.appendLog, function (err) {
forever.stat(fullLog, fullScript, options.append, function (err) {
if (err) {
forever.log.error('Cannot start forever');
forever.log.error(err.message);
Expand Down Expand Up @@ -190,7 +190,7 @@ var getOptions = cli.getOptions = function (file) {
app.config.use('argv', { argv: argvOptions });

[
'pidFile', 'logFile', 'errFile', 'watch', 'minUptime', 'appendLog',
'pidFile', 'logFile', 'errFile', 'watch', 'minUptime', 'append',
'silent', 'outFile', 'max', 'command', 'path', 'spinSleepTime',
'sourceDir', 'uid'
].forEach(function (key) {
Expand Down
10 changes: 7 additions & 3 deletions lib/forever/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var Monitor = exports.Monitor = function (script, options) {
this.logFile = options.logFile || path.join(forever.config.get('root'), this.uid + '.log');
this.outFile = options.outFile;
this.errFile = options.errFile;

this.append = options.append;
//
// Setup restart timing. These options control how quickly forever restarts
// a child process as well as when to kill a "spinning" process
Expand Down Expand Up @@ -147,10 +147,14 @@ Monitor.prototype.start = function (restart) {
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
if (this.outFile) {
child.stdout.pipe(fs.createWriteStream(this.outFile));
child.stdout.pipe(fs.createWriteStream(this.outFile, {
flags: this.append ? 'a+' : 'w+'
}));
}
if (this.errFile) {
child.stderr.pipe(fs.createWriteStream(this.errFile));
child.stderr.pipe(fs.createWriteStream(this.errFile, {
flags: this.append ? 'a+' : 'w+'
}));
}
}

Expand Down

0 comments on commit dd1508b

Please sign in to comment.