Skip to content

Commit

Permalink
repl: fix persistent history
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed May 2, 2015
1 parent 02388db commit fcf99e4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/internal/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ module.paths = require('module')._nodeModulePaths(module.filename);

function createRepl(env, cb) {
const opts = {
useGlobal: true,
ignoreUndefined: false
ignoreUndefined: false,
terminal: process.stdout.isTTY,
useGlobal: true
};

if (parseInt(env.NODE_NO_READLINE)) {
Expand Down Expand Up @@ -57,8 +58,8 @@ function createRepl(env, cb) {
}

const repl = REPL.start(opts);
if (opts.terminal && env.NODE_REPL_HISTORY_PATH) {
return setupHistory(repl, env.NODE_REPL_HISTORY_PATH, cb);
if (opts.terminal && env.NODE_REPL_HISTORY_FILE) {
return setupHistory(repl, env.NODE_REPL_HISTORY_FILE, cb);
}
repl._historyPrev = _replHistoryMessage;
cb(null, repl);
Expand Down Expand Up @@ -158,7 +159,7 @@ function _replHistoryMessage() {
if (this.history.length === 0) {
this._writeToOutput(
'\nPersistent history support disabled. ' +
'Set the NODE_REPL_HISTORY_PATH environment variable to ' +
'Set the NODE_REPL_HISTORY_FILE environment variable to ' +
'a valid, user-writable path to enable.\n'
);
this._refreshLine();
Expand Down

0 comments on commit fcf99e4

Please sign in to comment.