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

unexpected input argument will prompt --help but exit_code still be 0 #520

Closed
zongtaol opened this issue Mar 5, 2024 · 2 comments
Closed
Labels
accepted We are working on this and hope to release it into the product

Comments

@zongtaol
Copy link

zongtaol commented Mar 5, 2024

I am using run_subprocess function in python to invoke sbom-tool generate command. which given invalid input, it will prompt --help function, but exit_code is 0, which run_subprocess believe this command is executed successfully and continue to the next step.

Is there a way to tell the command got unexpected input and throw an exception instead of an exit_code = 0 return?
Screenshot 2024-03-05 134828

@pownkel
Copy link
Contributor

pownkel commented Mar 6, 2024

For some reason I can't reproduce the issue on powershell unless I'm using Python's subprocess.run() method, but it seems to happen consistently on cmd. It looks like the issue is that we don't explicitly set the exit code if the tool encounters an argument parsing error.

@pownkel pownkel added needs triage Default status upon issue submission accepted We are working on this and hope to release it into the product and removed needs triage Default status upon issue submission labels Mar 6, 2024
@DaveTryon
Copy link
Contributor

Fix has been merged and will be included in our next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted We are working on this and hope to release it into the product
Projects
None yet
Development

No branches or pull requests

3 participants