diff --git a/lib/forever.js b/lib/forever.js index e9518f8e..a879ad4b 100644 --- a/lib/forever.js +++ b/lib/forever.js @@ -392,13 +392,15 @@ forever.startDaemon = function (script, options) { errFD = fs.openSync(options.logFile, 'a'); monitorPath = path.resolve(__dirname, '..', 'bin', 'monitor'); - monitor = spawn(process.execPath, [ monitorPath, script ], { - stdio: [ 'ipc', outFD, errFD ], + monitor = spawn(process.execPath, [monitorPath, script], { + stdio: ['ipc', outFD, errFD], detached: true }); + monitor.on('exit', function (code) { console.error('Monitor died unexpectedly with exit code %d', code); }); + monitor.send(JSON.stringify(options)); monitor.unref(); };