Skip to content

Commit

Permalink
Stop or restart a process by its uid
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRadev authored and AvianFlu committed Apr 19, 2012
1 parent af5b8c2 commit 9c787df
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/forever.js
Expand Up @@ -180,7 +180,8 @@ function stopOrRestart(action, event, format, target) {

if (target) {
procs = forever.findByIndex(target, processes)
|| forever.findByScript(target, processes);
|| forever.findByScript(target, processes)
|| forever.findByUid(target, processes);
}

if (procs && procs.length > 0) {
Expand Down Expand Up @@ -555,6 +556,20 @@ forever.findByScript = function (script, processes) {
});
};

//
// ### function findByUid (uid, processes)
// #### @uid {string} The uid of the process to find.
// #### @processes {Array} Set of processes to find in.
// Finds the process with the specified uid.
//
forever.findByScript = function (script, processes) {
return !processes
? null
: processes.filter(function (p) {
return p.uid === script;
});
};

//
// ### function format (format, procs)
// #### @format {Boolean} Value indicating if processes should be formatted
Expand Down

0 comments on commit 9c787df

Please sign in to comment.