From 03eabd50cf00206bf043f49794f73158fe302b1c Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 16 Jan 2024 15:08:28 +0000 Subject: [PATCH] [10.x] Add exit code to queue:clear, and queue:forget commands (#49707) * [10.x] Add exit code to queue:clear, and queue:forget commands * Update ClearCommand.php --------- Co-authored-by: Taylor Otwell --- src/Illuminate/Queue/Console/ClearCommand.php | 2 ++ src/Illuminate/Queue/Console/ForgetFailedCommand.php | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Console/ClearCommand.php b/src/Illuminate/Queue/Console/ClearCommand.php index 6f3e8dc3bf9d..8f4187bcac77 100644 --- a/src/Illuminate/Queue/Console/ClearCommand.php +++ b/src/Illuminate/Queue/Console/ClearCommand.php @@ -57,6 +57,8 @@ public function handle() $this->components->info('Cleared '.$count.' '.Str::plural('job', $count).' from the ['.$queueName.'] queue'); } else { $this->components->error('Clearing queues is not supported on ['.(new ReflectionClass($queue))->getShortName().']'); + + return 1; } return 0; diff --git a/src/Illuminate/Queue/Console/ForgetFailedCommand.php b/src/Illuminate/Queue/Console/ForgetFailedCommand.php index 22d87d32b128..fce7803ccda7 100644 --- a/src/Illuminate/Queue/Console/ForgetFailedCommand.php +++ b/src/Illuminate/Queue/Console/ForgetFailedCommand.php @@ -25,7 +25,7 @@ class ForgetFailedCommand extends Command /** * Execute the console command. * - * @return void + * @return int|null */ public function handle() { @@ -33,6 +33,8 @@ public function handle() $this->components->info('Failed job deleted successfully.'); } else { $this->components->error('No failed job matches the given ID.'); + + return 1; } } }