Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli does not yield specific exit codes for different problems #2122

Closed
2 tasks done
jzorn opened this issue Apr 18, 2024 · 1 comment · Fixed by #2126
Closed
2 tasks done

cli does not yield specific exit codes for different problems #2122

jzorn opened this issue Apr 18, 2024 · 1 comment · Fixed by #2126
Labels
bug Something isn't working

Comments

@jzorn
Copy link
Contributor

jzorn commented Apr 18, 2024

I have checked the following:

  • I use the newest version of bruno.
  • I've searched existing issues and found nothing related to my issue.

Describe the bug

When using the cli in build pipelines, it's helpful to be able to identify the different reasons why an invocation failed:

  • assertion failed
  • non-existing output dir
  • environment not found
  • invalid output format
  • ...

By providing specific, immutable exit codes for all these scenarios, the pipeline/engineer can react appropriately without having to debug the error.

I propose to yield different exit codes for different problems via process.exit(...).

.bru file to reproduce the bug

No response

Screenshots/Live demo link

Running a collection with a failing assertion yields an exit code 1:

$ bru run
...
$ echo $?
1

Running a collection with a non-existing environment prints an error message, but exits with 0 (successful):

$ bru run --env foo
Environment file not found: environments/foo.bru
...
$ echo $?
0
@jzorn jzorn added the bug Something isn't working label Apr 18, 2024
jzorn added a commit to jzorn/bruno that referenced this issue Apr 18, 2024
This change adds specific exit status codes to identify different problems programatically
jzorn added a commit to jzorn/bruno that referenced this issue Apr 19, 2024
helloanoop pushed a commit that referenced this issue Jun 5, 2024
* fix: add specific error status codes #2122

This change adds specific exit status codes to identify different problems programatically

* feat(#2122): Document the cli exit status codes

* Update packages/bruno-cli/src/constants.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/constants.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

---------

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>
@helloanoop
Copy link
Contributor

This has been released in v1.19.0

jwetzell pushed a commit to jwetzell/bruno that referenced this issue Aug 2, 2024
* fix: add specific error status codes usebruno#2122

This change adds specific exit status codes to identify different problems programatically

* feat(usebruno#2122): Document the cli exit status codes

* Update packages/bruno-cli/src/constants.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/constants.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

* Update packages/bruno-cli/src/commands/run.js

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>

---------

Co-authored-by: Andreas Siegel <mail@andreassiegel.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants