thesofproject / rimage

DSP firmware image creation and signing tool
Other
7 stars 62 forks source link

Do not exit(0) on invalid options or parameters #70

Closed marc-hb closed 3 years ago

marc-hb commented 3 years ago

When some automation script gets some rimage flag wrong then rimage exits and does not run at all. In such a case we want the build to fail immediately and see the error at the bottom of the build logs and not obscured by other, consecutive failures caused by the lack of rimage output.

Take control of the exit code away from usage() and give it back to main() where it belongs.

Signed-off-by: Marc Herbert marc.herbert@intel.com

marc-hb commented 3 years ago

Tested in https://github.com/thesofproject/sof/pull/4778

aiChaoSONG commented 3 years ago

basically, I think the usage function itself should not handle exit, the caller should do, in -h, print usage and exit success, and other condition, print usage and exit failure. but this is another topic.

marc-hb commented 3 years ago

Totally agree with you @aiChaoSONG but on the other hand this PR is changing a single character :-)

keyonjie commented 3 years ago

@marc-hb I agree with @aiChaoSONG here, I prefer to remove the "exit(0)" from the usage(), and add 'exit(0)' to the '-h' 'exit(1)' to other callers.

marc-hb commented 3 years ago

I prefer to remove the "exit(0)" from the usage(), and add 'exit(0)' to the '-h' 'exit(1)' to other callers.

Done!