diff --git a/.travis.yml b/.travis.yml index ea90de772..94b123141 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ cache: yarn: true directories: - node_modules - - $HOME/.mongodb-prebuilt + - $HOME/.mongodb-binaries notifications: email: true node_js: diff --git a/src/util/MongoInstance.js b/src/util/MongoInstance.js index 082459f0f..379f38ba6 100644 --- a/src/util/MongoInstance.js +++ b/src/util/MongoInstance.js @@ -34,7 +34,7 @@ export type MongodOps = { debug?: boolean, }; -export default class BinRunner { +export default class MongodbInstance { static childProcessList: ChildProcess[] = []; opts: MongodOps; debug: Function; @@ -92,7 +92,9 @@ export default class BinRunner { } launchMongod(mongoBin: string): ChildProcess { - const childProcess = spawnChild(mongoBin, this.prepareCommandArgs(), this.opts.spawn); + const spawnOpts = this.opts.spawn || {}; + if (!spawnOpts.stdio) spawnOpts.stdio = 'ignore'; + const childProcess = spawnChild(mongoBin, this.prepareCommandArgs(), spawnOpts); childProcess.stderr.on('data', this.stderrHandler.bind(this)); childProcess.stdout.on('data', this.stdoutHandler.bind(this)); childProcess.on('close', this.closeHandler.bind(this)); @@ -103,11 +105,11 @@ export default class BinRunner { launchKiller(parentPid: number, childPid: number): ChildProcess { // spawn process which kills itself and mongo process if current process is dead - const killer = spawnChild(process.argv[0], [ - path.resolve(__dirname, 'mongo_killer.js'), - parentPid.toString(), - childPid.toString(), - ]); + const killer = spawnChild( + process.argv[0], + [path.resolve(__dirname, 'mongo_killer.js'), parentPid.toString(), childPid.toString()], + { stdio: 'ignore' } + ); return killer; }