Comparing version 0.6.2 to 0.6.3
@@ -19,2 +19,3 @@ /* | ||
nconf = require('nconf'), | ||
mkdirp = require('mkdirp').mkdirp, | ||
portfinder = require('portfinder'), | ||
@@ -283,3 +284,3 @@ timespan = require('timespan'), | ||
// | ||
forever.stop = function (target, format, restart) { | ||
forever.stop = function (target, format) { | ||
var emitter = new events.EventEmitter(), | ||
@@ -301,3 +302,3 @@ results = []; | ||
process.nextTick(function () { | ||
emitter.emit('stop', forever.format(format, processes)); | ||
emitter.emit('stop', forever.format(format, procs)); | ||
}); | ||
@@ -730,9 +731,4 @@ } | ||
function getAllProcesses (callback) { | ||
var results = [], | ||
sockPath = forever.config.get('sockPath'), | ||
sockets = fs.readdirSync(sockPath); | ||
if (sockets.length === 0) { | ||
return callback(); | ||
} | ||
var sockPath = forever.config.get('sockPath'), | ||
results = []; | ||
@@ -768,8 +764,38 @@ function getProcess (name, next) { | ||
async.forEach(sockets, getProcess, function () { | ||
callback(results); | ||
}); | ||
getSockets(sockPath, function (err, sockets) { | ||
if (err || (sockets && sockets.length === 0)) { | ||
return callback(err); | ||
} | ||
async.forEach(sockets, getProcess, function () { | ||
callback(results); | ||
}); | ||
}) | ||
}; | ||
// | ||
// ### function getSockets (sockPath, callback) | ||
// #### @sockPath {string} Path in which to look for UNIX domain sockets | ||
// #### @callback {function} Continuation to pass control to when complete | ||
// Attempts to read the files from `sockPath` if the directory does not exist, | ||
// then it is created using `mkdirp`. | ||
// | ||
function getSockets (sockPath, callback) { | ||
try { | ||
var sockets = fs.readdirSync(sockPath); | ||
} | ||
catch (ex) { | ||
if (ex.code !== 'ENOENT') { | ||
return callback(ex); | ||
} | ||
return mkdirp(sockPath, 0755, function (err) { | ||
return err ? callback(err) : callback(null, []); | ||
}); | ||
} | ||
callback(null, sockets); | ||
} | ||
// | ||
// ### function getAllPids () | ||
@@ -776,0 +802,0 @@ // Returns the set of all pids managed by forever. |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple CLI tool for ensuring that a given node script runs continuously (i.e. forever)", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"author": "Charlie Robbins <charlie.robbins@gmail.com>", | ||
@@ -34,2 +34,3 @@ "contributors": [ | ||
"daemon": "0.3.x", | ||
"mkdirp": "0.x.x", | ||
"nconf": "0.x.x", | ||
@@ -36,0 +37,0 @@ "optimist": "0.2.x", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
293767
1895
12
+ Addedmkdirp@0.x.x