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

fix: runCommand returns non-zero exit code for non-existing exes #256

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

miki725
Copy link
Contributor

@miki725 miki725 commented Mar 25, 2024

Issue

crashappsec/nimutils#65

Description

Running chalk docker ... when docker is not installed would not exit with appropriate exit code.

Testing

run chalk docker ... without docker being on PATH

@miki725 miki725 requested a review from viega as a code owner March 25, 2024 17:04
@miki725 miki725 requested a review from ee7 March 25, 2024 17:06
ee7
ee7 previously approved these changes Mar 27, 2024
Copy link
Contributor

@ee7 ee7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's trivial, could you add a test? Looks good to me otherwise.

Before this PR:

$ git log -1 --oneline
bafac54 (HEAD -> main, crashappsec/main) fix: error docker inspect logs during chalk exec (#248)
$ PATH='' chalk docker --version
error: docker command is missing. chalk requires docker binary installed to wrap docker commands.
$ echo $?
0 

With this PR:

$ git log -1 --oneline
81d5d9c (HEAD -> ms/exit, crashappsec/ms/exit) fix: runCommand returns non-zero exit code for non-existing exes
$ PATH='' chalk docker --version
error: docker command is missing. chalk requires docker binary installed to wrap docker commands.
docker: No such file or directory
$ echo $?
1

@miki725
Copy link
Contributor Author

miki725 commented Mar 27, 2024

this was an omission in nimutils. we probably need a whole bunch of unit tests there. will add simple integration tests here for now I guess then

@ee7
Copy link
Contributor

ee7 commented Mar 27, 2024

Yeah - just asserting the exit code of e.g. chalk docker --version when docker isn't in the PATH would be great, thanks.

@miki725 miki725 merged commit 13b635a into main Mar 27, 2024
3 checks passed
@miki725 miki725 deleted the ms/exit branch March 27, 2024 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants