supervisor
Advanced tools
Comparing version 0.5.7 to 0.6.0
@@ -12,2 +12,3 @@ var util = require("util"); | ||
var forceWatchFlag = false; | ||
var log = console.log | ||
@@ -23,4 +24,3 @@ exports.run = run; | ||
debug = false; | ||
util.debug = function(){}; | ||
util.puts = function(){}; | ||
log = function(){}; | ||
} else if (arg === "--harmony") { | ||
@@ -52,3 +52,3 @@ harmony = true; | ||
break; | ||
} else if (arg.indexOf("-") && !args.length) { | ||
} else if (arg[0] != "-" && !args.length) { | ||
// Assume last arg is the program | ||
@@ -109,3 +109,3 @@ program = [arg]; | ||
if (child) { | ||
util.debug("Sending "+signal+" to child..."); | ||
log("Sending "+signal+" to child..."); | ||
child.kill(signal); | ||
@@ -121,10 +121,12 @@ } | ||
util.puts("") | ||
util.debug("Running node-supervisor with"); | ||
util.debug(" program '" + program.join(" ") + "'"); | ||
util.debug(" --watch '" + watch + "'"); | ||
util.debug(" --ignore '" + ignore + "'"); | ||
util.debug(" --extensions '" + extensions + "'"); | ||
util.debug(" --exec '" + executor + "'"); | ||
util.puts(""); | ||
log("") | ||
log("Running node-supervisor with"); | ||
log(" program '" + program.join(" ") + "'"); | ||
log(" --watch '" + watch + "'"); | ||
if (ignore) { | ||
log(" --ignore '" + ignore + "'"); | ||
} | ||
log(" --extensions '" + extensions + "'"); | ||
log(" --exec '" + executor + "'"); | ||
log(""); | ||
@@ -144,3 +146,3 @@ // store the call to startProgramm in startChildProcess | ||
ignoredPaths[ignoreItem] = true; | ||
util.debug("Ignoring directory '" + ignoreItem + "'."); | ||
log("Ignoring directory '" + ignoreItem + "'."); | ||
}); | ||
@@ -152,3 +154,3 @@ } | ||
watchItem = path.resolve(watchItem); | ||
util.debug("Watching directory '" + watchItem + "' for changes."); | ||
log("Watching directory '" + watchItem + "' for changes."); | ||
findAllWatchFiles(watchItem, function(f) { | ||
@@ -160,3 +162,3 @@ watchGivenFile( f, poll_interval ); | ||
function print (m, n) { util.print(m+(!n?"\n":"")); return print; } | ||
function print (m, n) { console.log(m+(!n?"\n":"")); return print; } | ||
@@ -237,3 +239,3 @@ function help () { | ||
function startProgram (prog, exec) { | ||
util.debug("Starting child process with '" + exec + " " + prog.join(" ") + "'"); | ||
log("Starting child process with '" + exec + " " + prog.join(" ") + "'"); | ||
crash_queued = false; | ||
@@ -243,8 +245,8 @@ var child = exports.child = spawn(exec, prog, {stdio: 'inherit'}); | ||
// node < 0.8 doesn't understand the 'inherit' option, so pass through manually | ||
child.stdout.addListener("data", function (chunk) { chunk && util.print(chunk); }); | ||
child.stderr.addListener("data", function (chunk) { chunk && util.debug(chunk); }); | ||
child.stdout.addListener("data", function (chunk) { chunk && console.log(chunk); }); | ||
child.stderr.addListener("data", function (chunk) { chunk && console.error(chunk); }); | ||
} | ||
child.addListener("exit", function (code) { | ||
if (!crash_queued) { | ||
util.debug("Program " + exec + " " + prog.join(" ") + " exited with code " + code + "\n"); | ||
log("Program " + exec + " " + prog.join(" ") + " exited with code " + code + "\n"); | ||
exports.child = null; | ||
@@ -267,6 +269,6 @@ if (noRestartOn == "exit" || noRestartOn == "error" && code !== 0) return; | ||
if (child) { | ||
util.debug("crashing child"); | ||
log("crashing child"); | ||
process.kill(child.pid); | ||
} else { | ||
util.debug("restarting child"); | ||
log("restarting child"); | ||
startChildProcess(); | ||
@@ -307,3 +309,3 @@ } | ||
if (verbose) | ||
util.debug("watching file '" + watch + "'"); | ||
log("watching file '" + watch + "'"); | ||
} | ||
@@ -317,3 +319,3 @@ | ||
if (err) { | ||
util.error('Error retrieving stats for file: ' + dir); | ||
console.error('Error retrieving stats for file: ' + dir); | ||
} else { | ||
@@ -324,3 +326,3 @@ if (stats.isDirectory()) { | ||
if(err) { | ||
util.error('Error reading path: ' + dir); | ||
console.error('Error reading path: ' + dir); | ||
} | ||
@@ -327,0 +329,0 @@ else { |
{ "name" : "supervisor" | ||
, "version" : "0.5.7" | ||
, "version" : "0.6.0" | ||
, "description" : "A supervisor program for running nodejs programs" | ||
@@ -44,4 +44,4 @@ , "author" : "Isaac Z. Schlueter <i@izs.me>" | ||
} | ||
, "engines" : { "node" : ">=0.3.7" } | ||
, "engines" : { "node" : ">=0.6.0" } | ||
, "preferGlobal" : true | ||
} |
@@ -81,12 +81,10 @@ # node-supervisor | ||
Install npm, and then do this: | ||
Just run: | ||
npm install supervisor -g | ||
You don't even need to download or fork this repo at all. | ||
## Fancy Install | ||
Get this code, install npm, and then do this: | ||
Get this code, and then do this: | ||
npm link |
318
15944
90