Permalink
Browse files

use preventDefault instead of exit() in cli()

  • Loading branch information...
1 parent 7f09b94 commit 6cfd9e3835ae974a7d0c7db70e469c3eaf925676 @tj tj committed Aug 19, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/plugins/cli.js
View
@@ -89,7 +89,7 @@ exports = module.exports = function(){
command = commands[i];
if (~command.flags.indexOf(arg)) {
command.callback(master);
- process.exit(0);
+ master.preventDefault = true;
}
}
}

4 comments on commit 6cfd9e3

With this change, whenever I invoke a cli command, e.g., node server.js stop, it just hangs there after executing until I hit ^C. This is less than optimal. What was the motivation for this behaviour change?

Member
tj replied Aug 31, 2011

it will hang if you have connections etc active in the master process, which is probably what's going on

I'll try reducing it into a simple test case, but it's basically a simple Express app based on rgrove's combohandler. It's quite likely a file handle or something is lingering, since it is fairly basic and doesn't really listen for any cluster events (I hacked a local copy to use cluster instead of spark2).

Thanks for the swift response.

Member
tj replied Aug 31, 2011

the main problem is when you do cluster(server) you usually require() in an app with a lot of connections etc. I should have been more verbose with this commit message, I forget exactly what it was messing with but the hard exit was causing some issues

Please sign in to comment.