Skip to content

Commit

Permalink
fix(MemoryServer): use instance.kill() instead of childProcess.kill()
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Nov 7, 2017
1 parent 5151f87 commit c003c23
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/MongoMemoryServer.js
Expand Up @@ -145,15 +145,10 @@ export default class MongoMemoryServer {
}

async stop(): Promise<boolean> {
const { childProcess, port, tmpDir } = (await this.getInstanceData(): MongoInstanceDataT);
const { instance, port, tmpDir } = (await this.getInstanceData(): MongoInstanceDataT);

if (childProcess && childProcess.kill) {
this.debug(`Shutdown MongoDB server on port ${port} with pid ${childProcess.pid}`);
await new Promise(resolve => {
childProcess.once(`exit`, resolve);
childProcess.kill();
});
}
this.debug(`Shutdown MongoDB server on port ${port} with pid ${instance.getPid() || ''}`);
await instance.kill();

if (tmpDir) {
this.debug(`Removing tmpDir ${tmpDir.name}`);
Expand Down

0 comments on commit c003c23

Please sign in to comment.