Skip to content

Commit

Permalink
fixup: cr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Dec 13, 2024
1 parent 845e848 commit 3bcdc52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/cli-repl/src/mongosh-repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ class MongoshNodeRepl implements EvaluationListener {
});

repl.on('exit', () => {
// repl is already closed, no need to close it again via this.close()
if (this._runtimeState) this._runtimeState.repl = null;
this.onExit().catch(() => {
/* ... */
Expand Down Expand Up @@ -1036,7 +1037,7 @@ class MongoshNodeRepl implements EvaluationListener {
throw new MongoshInternalError(
`mongosh not initialized yet\nCurrent trace: ${
new Error().stack
}\nClose trace: ${this.closeTrace}\n`
}\nClose trace: ${this.closeTrace}`
);
}
return this._runtimeState;
Expand All @@ -1054,6 +1055,7 @@ class MongoshNodeRepl implements EvaluationListener {
this._runtimeState = null;
this.closeTrace = new Error().stack;
if (rs.repl) {
// Can be null if the repl already emitted 'exit'
rs.repl.close();
await once(rs.repl, 'exit');
}
Expand Down

0 comments on commit 3bcdc52

Please sign in to comment.