From e0404622f0990974b5633cf6ed6a4ae42d81907f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Tue, 24 Mar 2020 17:44:08 +0100 Subject: [PATCH] Fix exit codes in TenantAwareCommand --- src/Traits/TenantAwareCommand.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Traits/TenantAwareCommand.php b/src/Traits/TenantAwareCommand.php index 2d18a265..111d7b1e 100644 --- a/src/Traits/TenantAwareCommand.php +++ b/src/Traits/TenantAwareCommand.php @@ -10,7 +10,7 @@ use Symfony\Component\Console\Output\OutputInterface; trait TenantAwareCommand { - /** @return mixed|void */ + /** @return int */ protected function execute(InputInterface $input, OutputInterface $output) { $tenants = $this->getTenants(); @@ -21,13 +21,18 @@ trait TenantAwareCommand }); } + $exitCode = 0; foreach ($tenants as $tenant) { - $tenant->run(function () { - $this->laravel->call([$this, 'handle']); + $result = $tenant->run(function () { + return $this->laravel->call([$this, 'handle']); }); + + if ($result !== 0) { + $exitCode = $result; + } } - return 1; + return $exitCode; } /**