Summary
I'm encountering an issue while using rebar3 cmd <command>. With the transition to os:cmd/1, I'm unable to retrieve the return code accurately to determine whether the command has failed or not.
I'm using this functionality in a GitHub Actions workflow for checks. Having access to the return code is crucial for proper workflow automation and error handling.
Example
Consider the following simple example in my project's rebar.config:
{commands, [
{example, "ls non_existent_directory", []},
]}.
The command ls non_existent_directory always returns a return code of 1, indicating failure.
❯ ls non_existent_directory
ls: non_existent_directory: No such file or directory
❯ echo $?
1
However, when executed with rebar3 cmd example the return code is erroneously reported as 0, causing GitHub checks to be marked as successful even in case of failure:
❯ rebar3 cmd example
ls: non_existent_directory: No such file or directory
❯ echo $?
0
Summary
I'm encountering an issue while using
rebar3 cmd <command>. With the transition toos:cmd/1, I'm unable to retrieve the return code accurately to determine whether the command has failed or not.I'm using this functionality in a GitHub Actions workflow for checks. Having access to the return code is crucial for proper workflow automation and error handling.
Example
Consider the following simple example in my project's
rebar.config:{commands, [ {example, "ls non_existent_directory", []}, ]}.The command
ls non_existent_directoryalways returns a return code of 1, indicating failure.However, when executed with
rebar3 cmd examplethe return code is erroneously reported as 0, causing GitHub checks to be marked as successful even in case of failure: