Skip to content

Commit

Permalink
Return correct exit code on exceptions (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia authored Jul 10, 2023
1 parent aad49e9 commit 6d59da1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Command/TinkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Throwable;

use function Hyperf\Support\env;

Expand Down Expand Up @@ -96,7 +97,10 @@ public function handle()
if ($code = $this->input->getOption('execute')) {
try {
$shell->setOutput($this->output);
$shell->execute($code);
$shell->execute($code, true);
} catch (Throwable $e) {
$shell->writeException($e);
return 1;
} finally {
$loader->unregister();
}
Expand Down

0 comments on commit 6d59da1

Please sign in to comment.