diff --git a/lib/repl.js b/lib/repl.js index 130eece3e97a5e..0d237997c8f801 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -418,7 +418,8 @@ function REPLServer(prompt, // Check to see if a REPL keyword was used. If it returns true, // display next prompt and return. if (trimmedCmd) { - if (trimmedCmd.charAt(0) === '.' && isNaN(parseFloat(trimmedCmd))) { + if (trimmedCmd.charAt(0) === '.' && trimmedCmd.charAt(1) !== '.' && + isNaN(parseFloat(trimmedCmd))) { const matches = trimmedCmd.match(/^\.([^\s]+)\s*(.*)$/); const keyword = matches && matches[1]; const rest = matches && matches[2]; diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 1a3dce1c6f6591..f5df2d0ef40e09 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -414,7 +414,13 @@ function error_test() { expect: `${prompt_multiline}'foo \\n'\n${prompt_unix}` }, // Whitespace is not evaluated. { client: client_unix, send: ' \t \n', - expect: prompt_unix } + expect: 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}` } ]); }