Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ clean up all the inter-module references, and without a whole new
Supervisor will wait for a change in the source files.
If "error", an exit code of 0 will still restart.
If "exit", no restart regardless of exit code.

-d|--debug
Start node with --debug flag.

-k|--debug-brk
Start node with --debug-brk flag.

-h|--help|-?
Display these usage instructions.
Expand Down
14 changes: 14 additions & 0 deletions lib/supervisor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var fileExtensionPattern;
var startChildProcess;
var noRestartOn = null;
var debug = true;
var nodeArgs = [];

exports.run = run;

Expand All @@ -25,6 +26,10 @@ function run (args) {
extensions = args.shift();
} else if (arg === "--exec" || arg === "-x") {
executor = args.shift();
} else if ( arg === "--debug" || arg === "-d" ) {
nodeArgs.push('--debug');
} else if ( arg === "--debug-brk" || arg === "-k" ) {
nodeArgs.push('--debug-brk');
} else if (arg === "--no-restart-on" || arg === "-n") {
noRestartOn = args.shift();
} else if (arg === "--") {
Expand Down Expand Up @@ -114,6 +119,12 @@ function help () {
(" When a change to a js file occurs, reload the program")
(" Default is '.'")
("")
(" -d|--debug")
(" Start node with --debug flag.")
("")
(" -k|--debug-brk")
(" Start node with --debug-brk flag.")
("")
(" -p|--poll-interval <milliseconds>")
(" How often to poll watched files for changes.")
(" Defaults to Node default.")
Expand Down Expand Up @@ -153,6 +164,9 @@ function startProgram (prog, exec, args) {
else
util.debug("Starting child process with '" + exec + " " + prog + "'");
var spawnme = args ? [prog].concat(args) : [prog];
if ( nodeArgs ) {
spawnme = nodeArgs.concat(spawnme)
}
crash_queued = false;
var child = exports.child = spawn(exec, spawnme);
child.stdout.addListener("data", function (chunk) { chunk && util.print(chunk); });
Expand Down