mirror of
https://github.com/danog/process.git
synced 2024-11-26 20:24:43 +01:00
Check status before failing join deferred
This commit is contained in:
parent
04a4c8cea2
commit
8f837b3f94
@ -47,11 +47,14 @@ final class Runner implements ProcessRunner {
|
||||
if (!$pid || !\is_numeric($pid)) {
|
||||
$error = new ProcessException("Could not determine PID");
|
||||
$handle->pidDeferred->fail($error);
|
||||
$handle->joinDeferred->fail($error);
|
||||
foreach ($deferreds as $deferred) {
|
||||
/** @var $deferred Deferred */
|
||||
$deferred->fail($error);
|
||||
}
|
||||
if ($handle->status < ProcessStatus::ENDED) {
|
||||
$handle->status = ProcessStatus::ENDED;
|
||||
$handle->joinDeferred->fail($error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -148,8 +151,10 @@ final class Runner implements ProcessRunner {
|
||||
throw new ProcessException("Terminating process failed");
|
||||
}
|
||||
|
||||
$handle->status = ProcessStatus::ENDED;
|
||||
$handle->joinDeferred->fail(new ProcessException("The process was killed"));
|
||||
if ($handle->status < ProcessStatus::ENDED) {
|
||||
$handle->status = ProcessStatus::ENDED;
|
||||
$handle->joinDeferred->fail(new ProcessException("The process was killed"));
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
|
Loading…
Reference in New Issue
Block a user