Skip to content

Commit bc8153a

Browse files
committed
[minor] Trim whitespace in lib/*
1 parent 2a163d3 commit bc8153a

File tree

3 files changed

+25
-31
lines changed

3 files changed

+25
-31
lines changed

lib/forever.js

+22-28
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ forever.startDaemon = function (script, options) {
189189
options.pidFile = forever.pidFilePath(options.pidFile || options.uid + '.pid');
190190

191191
var monitor = new forever.Monitor(script, options);
192-
192+
193193
fs.open(options.logFile, options.appendLog ? 'a+' : 'w+', function (err, fd) {
194194
if (err) {
195195
return monitor.emit('error', err);
@@ -225,53 +225,47 @@ forever.startServer = function () {
225225
current = getData(),
226226
socket = path.join(forever.config.get('sockPath'), 'forever.sock'),
227227
server;
228-
228+
229229
function getData () {
230230
return monitors.map(function (m) { return m.data });
231231
}
232-
232+
233233
function formatProc (proc) {
234234
var info = [
235235
proc.command,
236236
proc.file,
237237
':',
238238
proc.uid
239239
].join(' ');
240-
240+
241241
return '[' + info + ']'
242242
}
243-
243+
244244
server = net.createServer(function (socket) {
245245
//
246246
// Write the specified data and close the socket
247247
//
248248
socket.end(JSON.stringify({ monitors: getData() }));
249249
});
250-
250+
251251
portfinder.getSocket({ path: socket }, function (err, socket) {
252252
if (err) {
253253
//
254254
// TODO: This is really bad.
255255
//
256256
}
257-
258-
server.on('error', function () {
257+
258+
server.on('error', function () {
259259
//
260260
// TODO: This is really bad.
261261
//
262262
});
263-
263+
264264
server.listen(socket, function () {
265265
if (callback) {
266266
callback(null, server, socket);
267267
}
268-
});
269-
270-
process.title = [
271-
'forever',
272-
current.map(function (p) { return formatProc(p) }),
273-
socket
274-
].join(' ');
268+
});
275269
});
276270
};
277271

@@ -405,14 +399,14 @@ forever.findByScript = function (script, processes) {
405399
//
406400
forever.stopAll = function (format) {
407401
var emitter = new events.EventEmitter();
408-
402+
409403
getAllProcesses(function (processes) {
410404
var pids = getAllPids(processes);
411405

412406
if (format) {
413407
processes = forever.format(format, processes);
414408
}
415-
409+
416410
if (pids && processes) {
417411
var fPids = pids.map(function (pid) { return pid.foreverPid }),
418412
cPids = pids.map(function (pid) { return pid.pid });
@@ -436,7 +430,7 @@ forever.stopAll = function (format) {
436430
});
437431
}
438432
});
439-
433+
440434
return emitter;
441435
};
442436

@@ -449,14 +443,14 @@ forever.stopAll = function (format) {
449443
forever.list = function (format, callback) {
450444
getAllProcesses(function (processes) {
451445
callback(null, forever.format(format, processes));
452-
});
446+
});
453447
};
454448

455449
forever.format = function (format, procs) {
456450
if (!procs || procs.length === 0) {
457451
return null;
458452
}
459-
453+
460454
if (format) {
461455
var index = 0, rows = [
462456
[' ', 'uid', 'command ', 'script', 'forever ', 'pid', 'logfile', 'uptime']
@@ -521,14 +515,14 @@ forever.cleanUp = function (cleanLogs, allowManager) {
521515
//
522516
// If we are cleaning logs then do so if the process
523517
// has a logfile.
524-
//
518+
//
525519
return fs.unlink(proc.logFile, function () {
526520
done();
527521
});
528522
}
529523

530524
done();
531-
});
525+
});
532526
}
533527

534528
function cleanProcess (proc, done) {
@@ -682,27 +676,27 @@ function getAllProcesses (callback) {
682676
if (sockets.length === 0) {
683677
return callback();
684678
}
685-
679+
686680
function getProcess (name, next) {
687681
var fullPath = path.join(sockPath, name),
688682
socket = new net.Socket({ type: 'unix' });
689-
683+
690684
socket.on('error', function (err) {
691685
if (err.code === 'ECONNREFUSED') {
692686
try { fs.unlinkSync(fullPath) }
693687
catch (ex) { }
694688
return next();
695689
}
696-
690+
697691
next(err);
698692
});
699-
693+
700694
socket.on('data', function (data) {
701695
var monitors = JSON.parse(data.toString());
702696
results.push.apply(results, monitors.monitors);
703697
next();
704698
});
705-
699+
706700
socket.connect(fullPath);
707701
}
708702

lib/forever/cli.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cli.exec = function (action, file, options) {
3535
});
3636
return;
3737
}
38-
38+
3939
if (file && action === 'start') {
4040
forever.log.info('Forever processing file: ' + file.grey);
4141
}
@@ -73,7 +73,7 @@ cli.start = function (file, options, daemon) {
7373
var monitor = daemon
7474
? forever.startDaemon(file, options)
7575
: forever.start(file, options);
76-
76+
7777
monitor.on('start', function () {
7878
forever.startServer(monitor);
7979
});

lib/forever/monitor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ Monitor.prototype.trySpawn = function () {
243243
};
244244

245245
//
246-
// ### @data
246+
// ### @data {Object}
247247
// Responds with the appropriate information about
248248
// this `Monitor` instance and it's associated child process.
249249
//

0 commit comments

Comments
 (0)