diff --git a/lib/repl.js b/lib/repl.js index 87014b5d5d2a90..02bbc6e9cc822b 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -387,7 +387,7 @@ function REPLServer(prompt, var rest = matches && matches[2]; if (self.parseREPLKeyword(keyword, rest) === true) { return; - } else { + } else if (!self.bufferedCommand) { self.outputStream.write('Invalid REPL keyword\n'); skipCatchall = true; } diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 5234d8e009ee58..2a6967ccfed5d8 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -117,6 +117,11 @@ function error_test() { expect: prompt_multiline }, { client: client_unix, send: '+ ".2"}`', expect: `'io.js 1.0.2'\n${prompt_unix}` }, + // Dot prefix in multiline commands aren't treated as commands + { client: client_unix, send: '("a"', + expect: prompt_multiline }, + { client: client_unix, send: '.charAt(0))', + expect: `'a'\n${prompt_unix}` }, // Floating point numbers are not interpreted as REPL commands. { client: client_unix, send: '.1234', expect: '0.1234' },