Skip to content

Console application returns exit code 0 on any exception #28666

Closed
@perprogramming

Description

@perprogramming

Symfony version(s) affected: 4.1.5

Description
The refactoring in commit 8805cfd by @fabpot broke the exit code handling for exceptions. Instead of calling the "exit" function with the correct error code the class simply returns the exit code from the run method. As there is no further code in the default "bin/console" script, php will end with exit code 0 indicating a success.

How to reproduce
Simply throw any exception within a symfony command and check the exit code of the console script.

Possible Solution
Remove the line "return $exitCode", which is line 163 in Console Application in version 4.1.5 (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Application.php#L163).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions