Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
repl: fix 'terminal' mode autodetection on global repls
Fixes test/simple/test-force-repl.js
  • Loading branch information
TooTallNate committed Mar 27, 2012
1 parent aad12d0 commit 698e795
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 6 additions & 3 deletions lib/_debugger.js
Expand Up @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions src/node.js
Expand Up @@ -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();
});
Expand Down

0 comments on commit 698e795

Please sign in to comment.