Skip to content

Commit

Permalink
fix critical bugs @v0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tjatse authored and indexzero committed Feb 5, 2015
1 parent 3e51b04 commit c33f56e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,18 @@ function stopOrRestart(action, event, format, target) {
});
}

var procs = processes;
var procs;
if (target !== undefined && target !== null) {
if (isNaN(target)) {
procs = forever.findByScript(target, processes);
}

procs = procs
|| forever.findById(target, processes)
|| forever.findByIndex(target, processes)
|| forever.findByUid(target, processes)
|| forever.findByPid(target, processes);
}else{
procs = processes;
}

if (procs && procs.length > 0) {
Expand Down Expand Up @@ -739,11 +740,14 @@ forever.findByScript = function (script, processes) {
// Finds the process with the specified uid.
//
forever.findByUid = function (script, processes) {
return !processes
var procs = !processes
? null
: processes.filter(function (p) {
return p.uid === script;
});

if (procs && procs.length === 0) { procs = null; }
return procs;
};

//
Expand All @@ -753,11 +757,14 @@ forever.findByUid = function (script, processes) {
// Finds the process with the specified pid.
//
forever.findByPid = function (pid, processes) {
return !processes
var procs = !processes
? null
: processes.filter(function (p) {
return p.pid == pid;
});

if (procs && procs.length === 0) { procs = null; }
return procs;
};

//
Expand Down

0 comments on commit c33f56e

Please sign in to comment.