mirror of
https://github.com/danog/process.git
synced 2024-11-26 20:24:43 +01:00
Fix hanging if process is destroyed during startup
This commit is contained in:
parent
a9f60b8d89
commit
96491ebfe1
@ -229,12 +229,16 @@ final class SocketConnector {
|
||||
return;
|
||||
}
|
||||
|
||||
$handle->status = ProcessStatus::RUNNING;
|
||||
$handle->pidDeferred->resolve($packet['pid']);
|
||||
$handle->exitCodeWatcher = Loop::onReadable($handle->sockets[0], [$this, 'onReadableExitCode'], $handle);
|
||||
|
||||
if (!$handle->exitCodeRequested) {
|
||||
Loop::unreference($handle->exitCodeWatcher);
|
||||
// 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