Skip to content

Commit

Permalink
Append log implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
kpdecker committed Feb 28, 2011
1 parent 588b2bf commit 51bc6c0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,21 @@ forever.startDaemon = function (script, options) {
options.pidFile = forever.pidFilePath(options.pidFile);
var runner = new forever.Monitor(script, options);

daemon.daemonize(options.logFile, options.pidFile, function (err, pid) {

fs.open(options.logFile, options.appendLog ? 'a+' : 'w+', function (err, fd) {
if (err) return runner.emit('error', err);


var pid = daemon.start(fd);
daemon.lock(options.pidFile);

//
// Remark: This should work, but the fd gets screwed up
// with the daemon process.
//
// process.on('exit', function () {
// fs.unlinkSync(options.pidFile);
// });

process.pid = pid;
runner.start();
});
Expand Down

0 comments on commit 51bc6c0

Please sign in to comment.