Skip to content

Commit ea5195c

Browse files
committed
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: #1574 PR-URL: #1575 Reviewed-By: Chris Dickinson <[email protected]>
1 parent 79a7a86 commit ea5195c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/repl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function createRepl(env, cb) {
5757
}
5858

5959
const repl = REPL.start(opts);
60-
if (env.NODE_REPL_HISTORY_PATH) {
60+
if (opts.terminal && env.NODE_REPL_HISTORY_PATH) {
6161
return setupHistory(repl, env.NODE_REPL_HISTORY_PATH, cb);
6262
}
6363
repl._historyPrev = _replHistoryMessage;

0 commit comments

Comments
 (0)