Skip to content

Commit

Permalink
[fix] Update startOrRestart to fix bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
coderarity committed Jun 6, 2012
1 parent 6a9a268 commit 4245e54
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function stopOrRestart(action, event, format, target) {
getAllProcesses(function (processes) {
var procs = processes;

if (target) {
if (target !== undefined && target !== null) {
procs = forever.findByIndex(target, processes)
|| forever.findByScript(target, processes)
|| forever.findByUid(target, processes);
Expand Down Expand Up @@ -549,11 +549,15 @@ forever.findByIndex = function (index, processes) {
// Finds the process with the specified script name.
//
forever.findByScript = function (script, processes) {
return !processes
? null
: processes.filter(function (p) {
return p.file === script;
});
if (!processes) return null;

var procs = processes.filter(function (p) {
return p.file === script;
});

if (procs.length === 0) procs = null;

return procs;
};

//
Expand Down

0 comments on commit 4245e54

Please sign in to comment.