Skip to content

Commit 9d35315

Browse files
committed
[fix minor] Update how forever._debug works. Use updated CLI options in forever restart
1 parent da86724 commit 9d35315

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

bin/forever

+4-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ if ((config.root && config.root !== forever.root)) {
212212
// it to the default `forever._debug`.
213213
//
214214
process.on('uncaughtException', function (err) {
215-
console.dir(err.stack.split('\n'));
215+
forever._debug();
216+
forever.log.error('uncaughtException');
217+
forever.log.error(err.message);
218+
forever.log.error(err.stack);
216219
});
217220

218221
//

lib/forever.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ forever.load = function (options) {
9090
];
9191
}
9292

93-
9493
forever.config.set('root', options.root);
9594
forever.config.set('pidPath', options.pidPath);
9695
forever.config.set('sockPath', options.sockPath);
@@ -138,10 +137,15 @@ forever.load = function (options) {
138137
// Sets up debugging for this forever process
139138
//
140139
forever._debug = function () {
141-
forever.config.set('debug', true);
142-
forever.log.add(winston.transports.File, {
143-
filename: path.join(forever.config.get('root'), 'forever.debug.log')
144-
});
140+
var debug = forever.config.get('debug');
141+
142+
if (!debug) {
143+
forever.config.set('debug', true);
144+
forever.log.add(winston.transports.File, {
145+
level: 'silly',
146+
filename: path.join(forever.config.get('root'), 'forever.debug.log')
147+
});
148+
}
145149
}
146150

147151
//
@@ -329,7 +333,7 @@ forever.restart = function (target, format) {
329333
var restartCommand = [
330334
'forever',
331335
'start',
332-
'-d', proc.sourceDir,
336+
'--sourceDir', proc.sourceDir,
333337
'-l', proc.logFile,
334338
'--append'
335339
];
@@ -347,6 +351,8 @@ forever.restart = function (target, format) {
347351
}
348352

349353
restartCommand.push(proc.file, proc.options.join(' '));
354+
forever.log.silly('Restarting with options', { options: restartCommand.join(' ') });
355+
350356
exec(restartCommand.join(' '), function (err, stdout, stderr) {
351357
next();
352358
});

0 commit comments

Comments
 (0)