Skip to content

Commit 0668c35

Browse files
committed
fix(MongoInstance::closeHandler): actually dont error with code 12 on windows
1 parent 754898d commit 0668c35

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/mongodb-memory-server-core/src/util/MongoInstance.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,10 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
537537
// check if the platform is windows, if yes check if the code is not "12" or "0" otherwise just check code is not "0"
538538
// because for mongodb any event on windows (like SIGINT / SIGTERM) will result in an code 12
539539
// https://docs.mongodb.com/manual/reference/exit-codes/#12
540-
if ((process.platform === 'win32' && code != 12 && code != 0) || code != 0) {
540+
if (
541+
(process.platform === 'win32' && code != 12 && code != 0) ||
542+
(process.platform !== 'win32' && code != 0)
543+
) {
541544
this.debug('closeHandler: Mongod instance closed with an non-0 (or non 12 on windows) code!');
542545
// Note: this also emits when a signal is present, which is expected because signals are not expected here
543546
this.emit(MongoInstanceEvents.instanceError, new UnexpectedCloseError(code, signal));

0 commit comments

Comments
 (0)