Skip to content

Commit

Permalink
[fix] Update forever.startDaemon to use adjusted daemon.node api.
Browse files Browse the repository at this point in the history
  • Loading branch information
AvianFlu committed Feb 25, 2012
1 parent f44d5f4 commit 5c8fcc5
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,25 +370,15 @@ forever.startDaemon = function (script, options, callback) {

var monitor = new forever.Monitor(script, options);

fs.open(options.logFile, options.appendLog ? 'a+' : 'w+', function (err, fd) {
if (err) {
return monitor.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;
monitor.start();
});
var pid = daemon.start(options.logFile);
daemon.lock(options.pidFile);

// process.on('exit', function () {
// fs.unlinkSync(options.pidFile);
// });

process.pid = pid;
monitor.start();

return monitor;
};
Expand Down

0 comments on commit 5c8fcc5

Please sign in to comment.