Skip to content

Commit

Permalink
[fix minor] Update how forever._debug works. Use updated CLI options …
Browse files Browse the repository at this point in the history
…in `forever restart`
  • Loading branch information
indexzero committed Jul 11, 2011
1 parent da86724 commit 9d35315
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
5 changes: 4 additions & 1 deletion bin/forever
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ if ((config.root && config.root !== forever.root)) {
// it to the default `forever._debug`.
//
process.on('uncaughtException', function (err) {
console.dir(err.stack.split('\n'));
forever._debug();
forever.log.error('uncaughtException');
forever.log.error(err.message);
forever.log.error(err.stack);
});

//
Expand Down
18 changes: 12 additions & 6 deletions lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ forever.load = function (options) {
];
}


forever.config.set('root', options.root);
forever.config.set('pidPath', options.pidPath);
forever.config.set('sockPath', options.sockPath);
Expand Down Expand Up @@ -138,10 +137,15 @@ forever.load = function (options) {
// Sets up debugging for this forever process
//
forever._debug = function () {
forever.config.set('debug', true);
forever.log.add(winston.transports.File, {
filename: path.join(forever.config.get('root'), 'forever.debug.log')
});
var debug = forever.config.get('debug');

if (!debug) {
forever.config.set('debug', true);
forever.log.add(winston.transports.File, {
level: 'silly',
filename: path.join(forever.config.get('root'), 'forever.debug.log')
});
}
}

//
Expand Down Expand Up @@ -329,7 +333,7 @@ forever.restart = function (target, format) {
var restartCommand = [
'forever',
'start',
'-d', proc.sourceDir,
'--sourceDir', proc.sourceDir,
'-l', proc.logFile,
'--append'
];
Expand All @@ -347,6 +351,8 @@ forever.restart = function (target, format) {
}

restartCommand.push(proc.file, proc.options.join(' '));
forever.log.silly('Restarting with options', { options: restartCommand.join(' ') });

exec(restartCommand.join(' '), function (err, stdout, stderr) {
next();
});
Expand Down

0 comments on commit 9d35315

Please sign in to comment.