1
0
mirror of https://github.com/danog/process.git synced 2024-11-26 20:24:43 +01:00

Fix kill during startup on Windows

This commit is contained in:
Niklas Keller 2017-12-05 09:44:06 +01:00
parent ff7d7612bb
commit 690d696dc9
2 changed files with 10 additions and 2 deletions

View File

@ -131,9 +131,12 @@ final class Runner implements ProcessRunner {
throw new ProcessException("Terminating process failed");
}
$failStart = false;
if ($handle->childPidWatcher !== null) {
Loop::cancel($handle->childPidWatcher);
$handle->childPidWatcher = null;
$failStart = true;
}
if ($handle->exitCodeWatcher !== null) {
@ -142,8 +145,13 @@ final class Runner implements ProcessRunner {
}
$handle->status = ProcessStatus::ENDED;
if ($failStart || $handle->stdioDeferreds) {
$this->socketConnector->failHandleStart($handle, "The process was killed");
} else {
$handle->joinDeferred->fail(new ProcessException("The process was killed"));
}
}
/** @inheritdoc */
public function signal(ProcessHandle $handle, int $signo) {

View File

@ -57,7 +57,7 @@ final class SocketConnector {
unset($this->pendingClients[(int) $socket]);
}
private function failHandleStart(Handle $handle, string $message, ...$args) {
public function failHandleStart(Handle $handle, string $message, ...$args) {
Loop::cancel($handle->connectTimeoutWatcher);
unset($this->pendingProcesses[$handle->wrapperPid]);