diff --git a/lib/forever.js b/lib/forever.js index 220a9151..f44d7533 100644 --- a/lib/forever.js +++ b/lib/forever.js @@ -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; };