Skip to content

Commit 209520f

Browse files
committed
fix(utils::killProcess): handle case where input could be undefined at runtime
somehow, it can come in undefined, so it needs to be handled fixes #666
1 parent 02452a4 commit 209520f

File tree

1 file changed

+7
-0
lines changed
  • packages/mongodb-memory-server-core/src/util

1 file changed

+7
-0
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ export async function killProcess(
9999
log(`Mongo[${mongodPort || 'unknown'}] killProcess: ${msg}`);
100100
}
101101

102+
// this case can somehow happen, see https://github.com/nodkz/mongodb-memory-server/issues/666
103+
if (isNullOrUndefined(childprocess)) {
104+
ilog('childprocess was somehow undefined');
105+
106+
return;
107+
}
108+
102109
// check if the childProcess (via PID) is still alive (found thanks to https://github.com/nodkz/mongodb-memory-server/issues/411)
103110
if (!isAlive(childprocess.pid)) {
104111
ilog("given childProcess's PID was not alive anymore");

0 commit comments

Comments
 (0)