Skip to content

Commit 9c787df

Browse files
AndrewRadevAvianFlu
authored andcommitted
Stop or restart a process by its uid
1 parent af5b8c2 commit 9c787df

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/forever.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ function stopOrRestart(action, event, format, target) {
180180

181181
if (target) {
182182
procs = forever.findByIndex(target, processes)
183-
|| forever.findByScript(target, processes);
183+
|| forever.findByScript(target, processes)
184+
|| forever.findByUid(target, processes);
184185
}
185186

186187
if (procs && procs.length > 0) {
@@ -555,6 +556,20 @@ forever.findByScript = function (script, processes) {
555556
});
556557
};
557558

559+
//
560+
// ### function findByUid (uid, processes)
561+
// #### @uid {string} The uid of the process to find.
562+
// #### @processes {Array} Set of processes to find in.
563+
// Finds the process with the specified uid.
564+
//
565+
forever.findByScript = function (script, processes) {
566+
return !processes
567+
? null
568+
: processes.filter(function (p) {
569+
return p.uid === script;
570+
});
571+
};
572+
558573
//
559574
// ### function format (format, procs)
560575
// #### @format {Boolean} Value indicating if processes should be formatted

0 commit comments

Comments
 (0)