Skip to content

Commit

Permalink
repl: do not save history for non-terminal repl
Browse files Browse the repository at this point in the history
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: #1574
PR-URL: #1575
Reviewed-By: Chris Dickinson <[email protected]>
  • Loading branch information
indutny committed May 2, 2015
1 parent 79a7a86 commit ea5195c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ea5195c

Please sign in to comment.