Skip to content

Commit 3bcdc52

Browse files
committed
fixup: cr comments
1 parent 845e848 commit 3bcdc52

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/cli-repl/src/mongosh-repl.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ class MongoshNodeRepl implements EvaluationListener {
546546
});
547547

548548
repl.on('exit', () => {
549+
// repl is already closed, no need to close it again via this.close()
549550
if (this._runtimeState) this._runtimeState.repl = null;
550551
this.onExit().catch(() => {
551552
/* ... */
@@ -1036,7 +1037,7 @@ class MongoshNodeRepl implements EvaluationListener {
10361037
throw new MongoshInternalError(
10371038
`mongosh not initialized yet\nCurrent trace: ${
10381039
new Error().stack
1039-
}\nClose trace: ${this.closeTrace}\n`
1040+
}\nClose trace: ${this.closeTrace}`
10401041
);
10411042
}
10421043
return this._runtimeState;
@@ -1054,6 +1055,7 @@ class MongoshNodeRepl implements EvaluationListener {
10541055
this._runtimeState = null;
10551056
this.closeTrace = new Error().stack;
10561057
if (rs.repl) {
1058+
// Can be null if the repl already emitted 'exit'
10571059
rs.repl.close();
10581060
await once(rs.repl, 'exit');
10591061
}

0 commit comments

Comments
 (0)