It isn't entirely clear: is this.process.kill() actually asynchronous? Here you return a promise that gets resolved once("exit"), which happens on "done". But *run* sometimes calls the same function to kill the process and then immediately starts up a new process.

If this.process.kill() is actually synchronous, then presumably exitCode is available by the time it returns, so it isn't necessary to wait for "exit" nor to return a promise here.

If, on the other hand, this is actually asynchronous, then *run* should also wait for *exit* after calling this.process.kill(); and it should probably reuse this function to kill the process.