From: Roman Reiss Date: Sat, 2 May 2015 21:47:17 +0000 (+0200) Subject: repl: fix persistent history and env variable name X-Git-Tag: v2.0.0~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2e2fce0502399db5d0902a0d3eb9528e1d9420c4;p=platform%2Fupstream%2Fnodejs.git repl: fix persistent history and env variable name Issue #1575 did introduce a check for options.terminal but this variable wasn't able to get truthy, which in turn broke persistent history completely. This changes the variable to get truthy on true terminals. Additionally, the docs and the code did differ on which environment variable was used for history. This changes the code to use NODE_REPL_HISTORY_FILE. PR-URL: https://github.com/iojs/io.js/pull/1593 Reviewed-By: Chris Dickinson --- diff --git a/lib/internal/repl.js b/lib/internal/repl.js index f2fea16..5faecae 100644 --- a/lib/internal/repl.js +++ b/lib/internal/repl.js @@ -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)) { @@ -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); @@ -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();