Permalink
Browse files

Support --debug, fixes #50

  • Loading branch information...
iangreenleaf committed Oct 10, 2012
1 parent a4021b8 commit 0a67d94dd24e8f561d6bd21edac2837e1fb1acd7
Showing with 24 additions and 1 deletion.
  1. +6 −0 README.md
  2. +18 −1 lib/supervisor.js
View
@@ -35,6 +35,12 @@ clean up all the inter-module references, and without a whole new
The executable that runs the specified program.
Default is 'node'
+ --debug
+ Start node with --debug flag.
+
+ --debug-brk
+ Start node with --debug-brk flag.
+
-n|--no-restart-on error|exit
Don't automatically restart the supervised program if it ends.
Supervisor will wait for a change in the source files.
View
@@ -12,7 +12,7 @@ var ignoredPaths = {};
exports.run = run;
function run (args) {
- var arg, next, watch, ignore, program, extensions, executor, poll_interval;
+ var arg, next, watch, ignore, program, extensions, executor, poll_interval, debugFlag, debugBrkFlag;
while (arg = args.shift()) {
if (arg === "--help" || arg === "-h" || arg === "-?") {
return help();
@@ -34,6 +34,10 @@ function run (args) {
executor = args.shift();
} else if (arg === "--no-restart-on" || arg === "-n") {
noRestartOn = args.shift();
+ } else if (arg === "--debug") {
+ debugFlag = true;
+ } else if (arg === "--debug-brk") {
+ debugBrkFlag = true;
} else if (arg === "--") {
program = args;
break;
@@ -68,6 +72,13 @@ function run (args) {
executor = (programExt === "coffee") ? "coffee" : "node";
}
+ if (debugFlag) {
+ program.unshift("--debug");
+ }
+ if (debugBrkFlag) {
+ program.unshift("--debug-brk");
+ }
+
try {
// Pass kill signals through to child
[ "SIGTERM", "SIGINT", "SIGHUP", "SIGQUIT" ].forEach( function(signal) {
@@ -160,6 +171,12 @@ function help () {
(" The executable that runs the specified program.")
(" Default is 'node'")
("")
+ (" --debug")
+ (" Start node with --debug flag.")
+ ("")
+ (" --debug-brk")
+ (" Start node with --debug-brk flag.")
+ ("")
(" -n|--no-restart-on error|exit")
(" Don't automatically restart the supervised program if it ends.")
(" Supervisor will wait for a change in the source files.")

0 comments on commit 0a67d94

Please sign in to comment.