diff --git a/lib/repl.js b/lib/repl.js index 923e9b25..65097cfb 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -78,7 +78,14 @@ return _results; }; process.on('uncaughtException', error); - repl = readline.createInterface(stdin, stdout, autocomplete); + if (readline.createInterface.length === 3) { + repl = readline.createInterface(stdin, stdout, autocomplete); + } else { + repl = readline.createInterface(stdin, autocomplete); + stdin.on('data', function(buffer) { + return repl.write(buffer); + }); + } repl.setPrompt('coffee> '); repl.on('close', function() { return stdin.destroy(); diff --git a/src/repl.coffee b/src/repl.coffee index 8418ecf0..1e2b3bff 100644 --- a/src/repl.coffee +++ b/src/repl.coffee @@ -77,7 +77,12 @@ getPropertyNames = (obj) -> process.on 'uncaughtException', error # Create the REPL by listening to **stdin**. -repl = readline.createInterface stdin, stdout, autocomplete +if readline.createInterface.length == 3 + repl = readline.createInterface stdin, stdout, autocomplete +else + repl = readline.createInterface stdin, autocomplete + stdin.on 'data', (buffer) -> repl.write buffer + repl.setPrompt 'coffee> ' repl.on 'close', -> stdin.destroy() repl.on 'line', run