File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments