From ea5195ccaf6d51262c9089c2ec5c6f5634bc12b5 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Fri, 1 May 2015 13:58:06 +0200 Subject: [PATCH] repl: do not save history for non-terminal repl When running in non-TTY mode - the `repl.history` is `undefined` and is not actually populated. Saving it will result in a crashes of subsequent repl runs. Fix: https://github.com/iojs/io.js/issues/1574 PR-URL: https://github.com/iojs/io.js/pull/1575 Reviewed-By: Chris Dickinson --- lib/internal/repl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/repl.js b/lib/internal/repl.js index 6fc5eefc1ba6d8..f2fea166a61d93 100644 --- a/lib/internal/repl.js +++ b/lib/internal/repl.js @@ -57,7 +57,7 @@ function createRepl(env, cb) { } const repl = REPL.start(opts); - if (env.NODE_REPL_HISTORY_PATH) { + if (opts.terminal && env.NODE_REPL_HISTORY_PATH) { return setupHistory(repl, env.NODE_REPL_HISTORY_PATH, cb); } repl._historyPrev = _replHistoryMessage;