Skip to content

Commit 3d16617

Browse files
committed
repl: eval empty lines, fixing debugger repeat
Tweak the better empty line handling introduced in nodejs#2163 so that empty lines are still passed to the eval function. This is required for the debugger to repeat the last command on an empty line. Fixes: nodejs#6010
1 parent f739a12 commit 3d16617

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/repl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ function REPLServer(prompt,
421421
}
422422
}
423423

424-
if (!skipCatchall && (cmd || (!cmd && self.bufferedCommand))) {
424+
if (!skipCatchall) {
425425
var evalCmd = self.bufferedCommand + cmd;
426426
if (/^\s*\{/.test(evalCmd) && /\}\s*$/.test(evalCmd)) {
427427
// It's confusing for `{ a : 1 }` to be interpreted as a block
@@ -483,7 +483,7 @@ function REPLServer(prompt,
483483
// immediately. We don't have to print anything else. So, only when
484484
// the second argument to this function is there, print it.
485485
arguments.length === 2 &&
486-
(!self.ignoreUndefined || ret !== undefined)) {
486+
(!(self.ignoreUndefined || evalCmd === '\n') || ret !== undefined)) {
487487
if (!self.underscoreAssigned) {
488488
self.last = ret;
489489
}

0 commit comments

Comments
 (0)