Added status codes returned by CLI commands

This commit is contained in:
Alejandro Celaya
2019-02-16 22:15:55 +01:00
parent 397b350cfc
commit eab5659163
18 changed files with 51 additions and 25 deletions

View File

@@ -48,7 +48,7 @@ class ProcessVisitsCommand extends Command
->setDescription('Processes visits where location is not set yet');
}
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): ?int
{
$this->output = $output;
$io = new SymfonyStyle($input, $output);
@@ -56,7 +56,7 @@ class ProcessVisitsCommand extends Command
$lock = $this->locker->createLock(self::NAME);
if (! $lock->acquire()) {
$io->warning(sprintf('There is already an instance of the "%s" command in execution', self::NAME));
return;
return 1;
}
try {
@@ -70,6 +70,7 @@ class ProcessVisitsCommand extends Command
$io->success('Finished processing all IPs');
} finally {
$lock->release();
return 0;
}
}