Skip to content

Regression: heroku run -x no longer returns correct exit code #2466

@dzuelke

Description

@dzuelke

Since 8.2.0:

$ heroku --version
heroku/8.1.9 darwin-x64 node-v16.19.0

$ heroku run -x -- 'bash -c "exit 2"' || echo $?  
Running bash -c "exit 2" on ⬢ sushi... up, run.6915 (Standard-1X)

 ›   Error: Process exited with code 2
 ›   Code: 2
2
$ heroku update --version 8.2.0


$ heroku --version             
heroku/8.2.0 darwin-x64 node-v16.19.0

$ heroku run -x -- 'bash -c "exit 2"' || echo $?
Running bash -c "exit 2" on ⬢ sushi... up, run.7202

Error: Process exited with code 2
1
$ heroku update


$ heroku --version
heroku/8.4.2 darwin-x64 node-v16.19.0

$ heroku run -x -- 'bash -c "exit 2"' || echo $?
Running bash -c "exit 2" on ⬢ sushi... up, run.2600 (Standard-1X)

Error: Process exited with code 2
1

Note: you have to use bash -c "exit 2" as the command; simply using exit 2 will terminate the shell and then the internal echo of the status code for later reading will not execute:

let command = this.opts['exit-code'] ? `${this.opts.command}; echo "\uFFFF heroku-command-exit-status: $?"` : this.opts.command
(the effective command is exit 2; echo "\uFFFF heroku-command-exit-status: $? vs bash -c "exit 2"; echo "\uFFFF heroku-command-exit-status: $?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions