Skip to content

Commit bc5995f

Browse files
committed
[fix minor] Keep processes silent on forever restart if requested. A couple of minor log formatting updates
1 parent f11610e commit bc5995f

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

lib/forever.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ forever.stat = function (logFile, script, callback) {
151151

152152
fs.stat(script, function (err, stats) {
153153
if (err) {
154-
return callback(new Error('Script ' + script + ' does not exist.'));
154+
return callback(new Error('script ' + script + ' does not exist.'));
155155
}
156156

157157
return logAppend ? callback(null) : fs.stat(logFile, function (err, stats) {
158158
return !err
159-
? callback(new Error('Log file ' + logFile + ' exists.'))
159+
? callback(new Error('log file ' + logFile + ' exists.'))
160160
: callback(null);
161161
});
162162
});
@@ -272,6 +272,10 @@ forever.restart = function (target, format) {
272272
'--append'
273273
];
274274

275+
if (proc.silent) {
276+
restartCommand.push('--silent');
277+
}
278+
275279
if (proc.outFile) {
276280
restartCommand.push('-o', path.join(proc.sourceDir, proc.outFile));
277281
}

lib/forever/cli.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ cli.restart = function (file) {
145145
forever.log.info('No forever processes running');
146146
}
147147
});
148+
149+
runner.on('error', function (err) {
150+
forever.log.error('Error restarting process: ' + file.grey);
151+
forever.log.error(err.message);
152+
});
148153
};
149154

150155
//
@@ -239,7 +244,8 @@ function tryStart (file, options, callback) {
239244

240245
forever.stat(fullLog, fullScript, options.appendLog, function (err) {
241246
if (err) {
242-
forever.log.error('Cannot start forever: ' + err.message);
247+
forever.log.error('Cannot start forever');
248+
forever.log.error(err.message);
243249
process.exit(-1);
244250
}
245251

lib/forever/monitor.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,15 @@ Monitor.prototype.save = function () {
227227
}
228228

229229
var childData = {
230-
uid: this.uid,
231230
ctime: this.ctime,
232231
command: this.command,
233-
pid: this.child.pid,
232+
file: this.options[0],
234233
foreverPid: process.pid,
235234
logFile: this.logFile,
236235
options: this.options.slice(1),
237-
file: this.options[0]
236+
pid: this.child.pid,
237+
silent: this.silent,
238+
uid: this.uid
238239
};
239240

240241
this.childData = childData;

0 commit comments

Comments
 (0)