Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Added support for node's --debug and --debug-brk flags #50

wants to merge 3 commits into from

4 participants


No description provided.


We've discussed a --debug flag in #48 for noisier logs, which would conflict with this. Not sure which is the more "expected" behavior.

Also relevant is #49, where we discuss the difficulty of passing arguments through to node or coffee. This pull request is probably the most common use case for that need.


So just voicing my opinion, this is totally something I want / need. node-inspector is a total godsend, and combine it with supervisor, and my dev life just gets easier and easier.

My usecase is precisely the #51 one.


I'm leaning towards thinking that this use of --debug is probably more important and expected than #48's. Unfortunately, this change won't work with CoffeeScript, since that needs an extra parameter. We could perhaps add awareness of that and include the extra parameter automatically, though it's toeing a fine line of special-case feature support.




Actually, I'm gonna move that discussion to #49. It might still be worth writing these two flags in as special cases, just to be nice to users.


wow, I seriously need this. why is this still open for 5+ months?

@lookfirst lookfirst referenced this pull request from a commit in lookfirst/node-supervisor
@lookfirst lookfirst port fix to issue #50 to latest code and some minor cleanup. 22663c9

@lookfirst you can achieve the same functionality using --, like so:

supervisor -- --debug

However, I recognize that this feature would be nice to have, and will probably add support for it soon.


Weird, I thought I tried that and it didn't work. Needless to say, just writing supervisor -d web to run my app sure is a lot nicer.


Thanks for the patch. This is finally included in v0.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 11, 2012
  1. Added support for --debug and --debug-brk flags

    Aneil Mallavarapu authored
  2. Added support for --debug and --debug-brk flags

    Aneil Mallavarapu authored
This page is out of date. Refresh to see the latest.
Showing with 20 additions and 0 deletions.
  1. +6 −0
  2. +14 −0 lib/supervisor.js
@@ -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.
Display these usage instructions.
14 lib/supervisor.js
@@ -5,6 +5,7 @@ var fileExtensionPattern;
var startChildProcess;
var noRestartOn = null;
var debug = true;
+var nodeArgs = []; = run;
@@ -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 === "--") {
@@ -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.")
@@ -153,6 +164,9 @@ function startProgram (prog, exec, args) {
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); });
Something went wrong with that request. Please try again.