Skip to content

rebar3 cmd <comand> : return code fails to indicate command failure status #31

Description

@oscarlamasrios

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions