When stepping through code with a command line debugger, it's really helpful to repeat the last command by hitting enter.
Steps to reproduce:
$ node debug script.js < Debugger listening on port 5858
connecting to 127.0.0.1:5858 ... ok
break in script.js:1
> 1 var a = 1;
2 var b = 2;
3 console.log(a);
debug> next
break in script.js:2
1 var a = 1;
> 2 var b = 2;
3 console.log(a);
4 console.log(b);
debug> debug>
The _debugger module seems to implement this in commandEval:
// Used for debugger's commands evaluation and executionInterface.prototype.controlEval=function(code,context,filename,callback){try{// Repeat last command if empty line are going to be evaluatedif(this.repl.rli.history&&this.repl.rli.history.length>0){if(code==='\n'){code=this.repl.rli.history[0]+'\n';}}https://github.com/nodejs/node/blob/v5.9.1/lib/_debugger.js#L943-L951
Unfortunately it seems that the repl's self.eval is no longer called for empty commands:
if(!skipCatchall&&(cmd||(!cmd&&self.bufferedCommand))){varevalCmd=self.bufferedCommand+cmd;if(/^\s*\{/.test(evalCmd)&&/\}\s*$/.test(evalCmd)){// It's confusing for `{ a : 1 }` to be interpreted as a block// statement rather than an object literal. So, we first try// to wrap it in parentheses, so that it will be interpreted as// an expression.evalCmd='('+evalCmd+')\n';}else{// otherwise we just append a \n so that it will be either// terminated, or continued onto the next expression if it's an// unexpected end of input.evalCmd=evalCmd+'\n';}debug('eval %j',evalCmd);self.eval(evalCmd,self.context,'repl',finish);}else{finish(null);}https://github.com/nodejs/node/blob/v5.9.1/lib/repl.js#L413-L432
- Version: 5.9.1
- Platform: Darwin MachineName.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
- Subsystem:
_debugger
When stepping through code with a command line debugger, it's really helpful to repeat the last command by hitting enter.
Steps to reproduce:
The _debugger module seems to implement this in commandEval:
https://github.com/nodejs/node/blob/v5.9.1/lib/_debugger.js#L943-L951
Unfortunately it seems that the repl's
self.evalis no longer called for empty commands:https://github.com/nodejs/node/blob/v5.9.1/lib/repl.js#L413-L432
_debugger