In selftest in Windows, kill child processes more

In a previous commit we did that in one but not all cases in selftest
where we try to kill child processes.
This commit is contained in:
Avital Oliver
2015-02-06 13:53:34 -08:00
parent b276aa79ca
commit ff32eb5722

View File

@@ -1308,14 +1308,7 @@ _.extend(Run.prototype, {
if (self.exitStatus === undefined) {
self._ensureStarted();
self.client && self.client.stop();
if (process.platform === "win32") {
// looks like in Windows `self.proc.kill()` doesn't kill child
// processes.
utils.execFileSync("taskkill", ["/pid", self.proc.pid, '/f', '/t']);
} else {
self.proc.kill();
}
self._killProcess();
self.expectExit();
}
}),
@@ -1325,7 +1318,21 @@ _.extend(Run.prototype, {
var self = this;
if (self.exitStatus === undefined && self.proc) {
self.client && self.client.stop();
self.proc.kill();
self._killProcess();
}
},
// Kills the running process and it's child processes
_killProcess: function () {
if (!this.proc)
throw new Error("Unexpected: `this.proc` undefined when calling _killProcess");
if (process.platform === "win32") {
// looks like in Windows `self.proc.kill()` doesn't kill child
// processes.
utils.execFileSync("taskkill", ["/pid", this.proc.pid, '/f', '/t']);
} else {
this.proc.kill();
}
},