Skip to content

Commit c33f56e

Browse files
Tjatseindexzero
authored andcommitted
fix critical bugs @v0.14.0
1 parent 3e51b04 commit c33f56e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/forever.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,18 @@ function stopOrRestart(action, event, format, target) {
223223
});
224224
}
225225

226-
var procs = processes;
226+
var procs;
227227
if (target !== undefined && target !== null) {
228228
if (isNaN(target)) {
229229
procs = forever.findByScript(target, processes);
230230
}
231-
232231
procs = procs
233232
|| forever.findById(target, processes)
234233
|| forever.findByIndex(target, processes)
235234
|| forever.findByUid(target, processes)
236235
|| forever.findByPid(target, processes);
236+
}else{
237+
procs = processes;
237238
}
238239

239240
if (procs && procs.length > 0) {
@@ -739,11 +740,14 @@ forever.findByScript = function (script, processes) {
739740
// Finds the process with the specified uid.
740741
//
741742
forever.findByUid = function (script, processes) {
742-
return !processes
743+
var procs = !processes
743744
? null
744745
: processes.filter(function (p) {
745746
return p.uid === script;
746747
});
748+
749+
if (procs && procs.length === 0) { procs = null; }
750+
return procs;
747751
};
748752

749753
//
@@ -753,11 +757,14 @@ forever.findByUid = function (script, processes) {
753757
// Finds the process with the specified pid.
754758
//
755759
forever.findByPid = function (pid, processes) {
756-
return !processes
760+
var procs = !processes
757761
? null
758762
: processes.filter(function (p) {
759763
return p.pid == pid;
760764
});
765+
766+
if (procs && procs.length === 0) { procs = null; }
767+
return procs;
761768
};
762769

763770
//

0 commit comments

Comments
 (0)