don't use global vars
authorFedor Indutny <fedor.indutny@gmail.com>
Thu, 22 Sep 2011 09:47:01 +0000 (16:47 +0700)
committerRyan Dahl <ry@tinyclouds.org>
Fri, 23 Sep 2011 20:42:41 +0000 (13:42 -0700)
lib/_debugger.js

index aba63a0..73abad0 100644 (file)
@@ -57,9 +57,6 @@ exports.start = function(argv, stdin, stdout) {
 };
 
 
-var args = process.argv.slice(2);
-args.unshift('--debug-brk');
-
 
 
 //
@@ -708,12 +705,13 @@ function SourceInfo(body) {
 
 // This class is the repl-enabled debugger interface which is invoked on
 // "node debug"
-function Interface(stdin, stdout) {
+function Interface(stdin, stdout, args) {
   var self = this,
       child;
 
   this.stdin = stdin;
   this.stdout = stdout;
+  this.args = args;
 
   var streams = {
     stdin: stdin,
@@ -1413,7 +1411,7 @@ Interface.prototype.trySpawn = function(cb) {
 
   this.killChild();
 
-  this.child = spawn(process.execPath, args);
+  this.child = spawn(process.execPath, this.args);
 
   this.child.stdout.on('data', this.childPrint.bind(this));
   this.child.stderr.on('data', this.childPrint.bind(this));