diff --git a/lib/repl.js b/lib/repl.js index 65097cfb..6b5d3364 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -78,13 +78,13 @@ return _results; }; process.on('uncaughtException', error); - if (readline.createInterface.length === 3) { - repl = readline.createInterface(stdin, stdout, autocomplete); - } else { + if (readline.createInterface.length < 2) { repl = readline.createInterface(stdin, autocomplete); stdin.on('data', function(buffer) { return repl.write(buffer); }); + } else { + repl = readline.createInterface(stdin, stdout, autocomplete); } repl.setPrompt('coffee> '); repl.on('close', function() { diff --git a/src/repl.coffee b/src/repl.coffee index 1e2b3bff..142227d8 100644 --- a/src/repl.coffee +++ b/src/repl.coffee @@ -77,11 +77,11 @@ getPropertyNames = (obj) -> process.on 'uncaughtException', error # Create the REPL by listening to **stdin**. -if readline.createInterface.length == 3 - repl = readline.createInterface stdin, stdout, autocomplete -else +if readline.createInterface.length < 3 repl = readline.createInterface stdin, autocomplete - stdin.on 'data', (buffer) -> repl.write buffer + stdin.on 'data', (buffer) -> repl.write buffer +else + repl = readline.createInterface stdin, stdout, autocomplete repl.setPrompt 'coffee> ' repl.on 'close', -> stdin.destroy()