Work around https://bugs.php.net/bug.php?id=75396
This commit is contained in:
9
bin/acme
9
bin/acme
@@ -144,8 +144,9 @@ $injector->share(new AcmeFactory);
|
|||||||
$injector->share(new Amp\Artax\DefaultClient);
|
$injector->share(new Amp\Artax\DefaultClient);
|
||||||
|
|
||||||
$command = $injector->make($class);
|
$command = $injector->make($class);
|
||||||
|
$exitCode = 1;
|
||||||
|
|
||||||
Loop::run(function () use ($command, $climate) {
|
Loop::run(function () use ($command, $climate, &$exitCode) {
|
||||||
$handler = function ($e) use ($climate) {
|
$handler = function ($e) use ($climate) {
|
||||||
$error = (string) $e;
|
$error = (string) $e;
|
||||||
$lines = explode("\n", $error);
|
$lines = explode("\n", $error);
|
||||||
@@ -164,13 +165,13 @@ Loop::run(function () use ($command, $climate) {
|
|||||||
$exitCode = yield $command->execute($climate->arguments);
|
$exitCode = yield $command->execute($climate->arguments);
|
||||||
|
|
||||||
if ($exitCode === null) {
|
if ($exitCode === null) {
|
||||||
exit(0);
|
$exitCode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
exit($exitCode);
|
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$handler($e);
|
$handler($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Loop::stop();
|
Loop::stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exit($exitCode);
|
||||||
|
|||||||
Reference in New Issue
Block a user