From 698e795a5ffb617c5a3e3e79de7dfdd0ce637695 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Mon, 26 Mar 2012 19:05:32 -0700 Subject: [PATCH] repl: fix 'terminal' mode autodetection on global repls Fixes test/simple/test-force-repl.js --- lib/_debugger.js | 9 ++++++--- src/node.js | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/_debugger.js b/lib/_debugger.js index dcf046bcf5..64ea20df6e 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -747,15 +747,18 @@ function Interface(stdin, stdout, args) { // Two eval modes are available: controlEval and debugEval // But controlEval is used by default - this.repl = repl.start({ + var opts = { prompt: 'debug> ', input: this.stdin, output: this.stdout, - terminal: !parseInt(process.env['NODE_NO_READLINE'], 10), eval: this.controlEval.bind(this), useGlobal: false, ignoreUndefined: true - }); + }; + if (parseInt(process.env['NODE_NO_READLINE'], 10)) { + opts.terminal = false; + } + this.repl = repl.start(opts); // Do not print useless warning repl._builtinLibs.splice(repl._builtinLibs.indexOf('repl'), 1); diff --git a/src/node.js b/src/node.js index fad3845564..512a647dad 100644 --- a/src/node.js +++ b/src/node.js @@ -121,12 +121,14 @@ // If -i or --interactive were passed, or stdin is a TTY. if (process._forceRepl || NativeModule.require('tty').isatty(0)) { // REPL - var repl = Module.requireRepl().start({ - prompt: '> ', - terminal: !parseInt(process.env['NODE_NO_READLINE'], 10), + var opts = { useGlobal: true, ignoreUndefined: false - }); + }; + if (parseInt(process.env['NODE_NO_READLINE'], 10)) { + opts.terminal = false; + } + var repl = Module.requireRepl().start(opts); repl.on('exit', function() { process.exit(); });