diff --git a/lib/repl.js b/lib/repl.js index b48242be1bc763..127fd80bf82f65 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -519,10 +519,11 @@ function REPLServer(prompt, // Check to see if a REPL keyword was used. If it returns true, // display next prompt and return. - if (cmd && cmd.charAt(0) === '.' && isNaN(parseFloat(cmd))) { - var matches = cmd.match(/^\.([^\s]+)\s*(.*)$/); - var keyword = matches && matches[1]; - var rest = matches && matches[2]; + if (cmd && cmd.charAt(0) === '.' && cmd.charAt(1) !== '.' && + isNaN(parseFloat(cmd))) { + const matches = cmd.match(/^\.([^\s]+)\s*(.*)$/); + const keyword = matches && matches[1]; + const rest = matches && matches[2]; if (self.parseREPLKeyword(keyword, rest) === true) { return; } else if (!self.bufferedCommand) { diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index c471b185dd6531..3b705f7b6be97f 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -387,7 +387,13 @@ function error_test() { { client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())', expect: `${prompt_multiline}${prompt_multiline}undefined\n${prompt_unix}` - } + }, + // Do not parse `...[]` as a REPL keyword + { client: client_unix, send: '...[]\n', + expect: `${prompt_multiline}` }, + // bring back the repl to prompt + { client: client_unix, send: '.break', + expect: `${prompt_unix}` } ]); }