1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 10:14:04 +00:00

Fix exit codes in TenantAwareCommand

This commit is contained in:
Samuel Štancl 2020-03-24 17:44:08 +01:00
parent 245d998d59
commit e0404622f0

View file

@ -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;
}
/**