supervisor
Advanced tools
Comparing version 0.7.1 to 0.8.0
@@ -12,2 +12,3 @@ var util = require("util"); | ||
var forceWatchFlag = false; | ||
var interactive = true; | ||
var log = console.log; | ||
@@ -31,2 +32,4 @@ | ||
watch = args.shift(); | ||
} else if (arg == "--non-interactive" || arg === "-t") { | ||
interactive = false; | ||
} else if (arg === "--ignore" || arg === "-i") { | ||
@@ -154,2 +157,5 @@ ignore = args.shift(); | ||
log(" --watch '" + watch + "'"); | ||
if (!interactive) { | ||
log(" --non-interactive"); | ||
} | ||
if (ignore) { | ||
@@ -173,19 +179,23 @@ log(" --ignore '" + ignore + "'"); | ||
// | ||
// Read input from stdin | ||
// | ||
var stdin = process.stdin; | ||
// If interaction has not been disabled, start the CLI | ||
if(interactive) { | ||
stdin.setEncoding( 'utf8' ); | ||
stdin.on('readable', function() { | ||
var chunk = process.stdin.read(); | ||
// | ||
// Restart process when user inputs rs | ||
// Read input from stdin | ||
// | ||
if (chunk !== null && chunk === "rs\n") { | ||
// process.stdout.write('data: ' + chunk); | ||
crash(); | ||
} | ||
}); | ||
var stdin = process.stdin; | ||
stdin.setEncoding( 'utf8' ); | ||
stdin.on('readable', function() { | ||
var chunk = process.stdin.read(); | ||
// | ||
// Restart process when user inputs rs | ||
// | ||
if (chunk !== null && chunk === "rs\n") { | ||
// process.stdout.write('data: ' + chunk); | ||
crash(); | ||
} | ||
}); | ||
} | ||
if (ignore) { | ||
@@ -203,7 +213,12 @@ var ignoreItems = ignore.split(','); | ||
watchItem = path.resolve(watchItem); | ||
log("Watching directory '" + watchItem + "' for changes."); | ||
log("Press rs for restarting the process."); | ||
findAllWatchFiles(watchItem, function(f) { | ||
watchGivenFile( f, poll_interval ); | ||
}); | ||
if ( ! ignoredPaths[watchItem] ) { | ||
log("Watching directory '" + watchItem + "' for changes."); | ||
if(interactive) { | ||
log("Press rs for restarting the process."); | ||
} | ||
findAllWatchFiles(watchItem, function(f) { | ||
watchGivenFile( f, poll_interval ); | ||
}); | ||
} | ||
}); | ||
@@ -267,2 +282,6 @@ }; | ||
("") | ||
(" -t|--non-interactive") | ||
(" Dissable interactive capacity") | ||
(" With this option, supervisor won't listen to stdin") | ||
("") | ||
(" --force-watch") | ||
@@ -269,0 +288,0 @@ (" Use fs.watch instead of fs.watchFile.") |
{ "name" : "supervisor" | ||
, "version" : "0.7.1" | ||
, "version" : "0.8.0" | ||
, "description" : "A supervisor program for running nodejs programs" | ||
@@ -4,0 +4,0 @@ , "author" : "Isaac Z. Schlueter <i@izs.me>" |
@@ -63,2 +63,6 @@ # node-supervisor | ||
-t|--non-interactive | ||
Dissable interactive capacity | ||
With this option, supervisor won't listen to stdin | ||
--force-watch | ||
@@ -73,6 +77,6 @@ Use fs.watch instead of fs.watchFile. | ||
Suppress DEBUG messages | ||
Options available after start: | ||
rs - restart process. Useful when you want to restart your program eaven | ||
rs - restart process. Useful when you want to restart your program even | ||
if no file has changed. | ||
@@ -89,2 +93,4 @@ | ||
In order to not watch for file changes, use "-i .". | ||
## Simple Install | ||
@@ -91,0 +97,0 @@ |
#!/usr/bin/env node | ||
var express = require('express'); | ||
@@ -9,4 +10,4 @@ var app = express(); | ||
// | ||
res.setHeader("Access-Control-Allow-Origin", "http://cors-client.com"); | ||
res.send('Hello World!') | ||
res.setHeader("Access-Control-Allow-Origin", "*"); | ||
res.send('Hello World!'); | ||
}); | ||
@@ -17,4 +18,3 @@ | ||
var port = server.address().port; | ||
console.log('Example app listening at http://%s:%s', host, port); | ||
}); |
20001
435
104