Skip to content

Commit

Permalink
Fix #47673
Browse files Browse the repository at this point in the history
  • Loading branch information
STRd6 committed Sep 2, 2023
1 parent 0add7a8 commit b993b72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ function REPLServer(prompt,
self[kBufferedCommandSymbol] += cmd + '\n';

// code alignment
const matches = self._sawKeyPress ?
const matches = self._sawKeyPress && !self._loading ?
RegExpPrototypeExec(/^\s+/, cmd) : null;
if (matches) {
const prefix = matches[0];
Expand Down Expand Up @@ -1801,8 +1801,10 @@ function defineDefaultCommands(repl) {
const stats = fs.statSync(file);
if (stats && stats.isFile()) {
_turnOnEditorMode(this);
this._loading = true
const data = fs.readFileSync(file, 'utf8');
this.write(data);
this._loading = false
_turnOffEditorMode(this);
this.write('\n');
} else {
Expand Down

0 comments on commit b993b72

Please sign in to comment.