Browse Source

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 <christopher.s.dickinson@gmail.com>
v2.0.2
Fedor Indutny 10 years ago
parent
commit
ea5195ccaf
  1. 2
      lib/internal/repl.js

2
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;

Loading…
Cancel
Save