Skip to content

horizon:terminate should not fail when no processes are found #1724

@jevgenijsblaus

Description

@jevgenijsblaus

Horizon Version

5.45.1

Laravel Version

11.48.0

PHP Version

8.4.18

Redis Driver

PhpRedis

Redis Version

6.0.16

Database Driver & Version

No response

Description

Since #1718, horizon:terminate returns exit code 1 (failure) when no Horizon processes are running. Previously, it returned exit code 0 with an informational message.

This is a breaking change that causes deployment pipelines to fail when Horizon is not currently running.

Problem

In TerminateCommand.php:57-61, the whenEmpty callback sets $exitCode = Command::FAILURE.

"No processes to terminate." is not an error condition — it's a valid state. Having no PID to signal simply means there's nothing to do — the desired state (Horizon not running) is already achieved.

Expected Behavior

horizon:terminate should return exit code 0 when no processes are found, as it did before #1718. The "No processes to terminate." message is fine as informational output, but should not be a failure.

Impact

Any CI/CD pipeline or deployment tool (Deployer) that runs artisan horizon:terminate as part of a deploy sequence now breaks if Horizon isn't running at that moment.

Suggested Fix

Remove Command::FAILURE and use warn or leave info.

Steps To Reproduce

  1. Have Horizon installed but not running
  2. Run php artisan horizon:terminate
  3. Exit code is 1 with "No processes to terminate."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions