mirror of
https://github.com/danog/process.git
synced 2024-11-30 04:39:04 +01:00
Fix hanging if process is destroyed during startup
This commit is contained in:
parent
a9f60b8d89
commit
96491ebfe1
@ -229,13 +229,17 @@ final class SocketConnector {
|
||||
return;
|
||||
}
|
||||
|
||||
$handle->status = ProcessStatus::RUNNING;
|
||||
$handle->pidDeferred->resolve($packet['pid']);
|
||||
|
||||
// Required, because a process might be destroyed while starting
|
||||
if ($handle->status === ProcessStatus::STARTING) {
|
||||
$handle->status = ProcessStatus::RUNNING;
|
||||
$handle->exitCodeWatcher = Loop::onReadable($handle->sockets[0], [$this, 'onReadableExitCode'], $handle);
|
||||
|
||||
if (!$handle->exitCodeRequested) {
|
||||
Loop::unreference($handle->exitCodeWatcher);
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->pendingProcesses[$handle->wrapperPid]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user