Permalink
Browse files

[refactor] Make `forever.checkProcess` synchronous

  • Loading branch information...
mmalecki authored and indexzero committed Oct 10, 2011
1 parent f820056 commit c17d004442931c861c79c8206f94c09e69f3163c
Showing with 7 additions and 11 deletions.
  1. +7 −11 lib/forever.js
View
@@ -740,13 +740,9 @@ forever.cleanUp = function (cleanLogs, allowManager) {
}
function checkProcess(proc, next) {
- forever.checkProcess(proc.pid, function (child) {
- proc.child = child;
- forever.checkProcess(proc.foreverPid, function (manager) {
- proc.manager = manager;
- cleanProcess(proc, next);
- });
- });
+ proc.child = forever.checkProcess(proc.pid);
+ proc.manager = forever.checkProcess(proc.foreverPid);
+ cleanProcess(proc, next);
}
if (processes && processes.length > 0) {
@@ -848,9 +844,9 @@ forever.pidFilePath = function (pidFile) {
// #### @callback {function} Continuation to pass control backto.
// Utility function to check to see if a pid is running
//
-forever.checkProcess = function (pid, callback) {
+forever.checkProcess = function (pid) {
if (!pid) {
- return callback(false);
+ return false;
}
try {
@@ -860,10 +856,10 @@ forever.checkProcess = function (pid, callback) {
// only checks if sending a singal to a given process is possible.
//
process.kill(pid, 0);
- callback(true);
+ return true;
}
catch (err) {
- callback(false);
+ return false;
}
};

0 comments on commit c17d004

Please sign in to comment.