easybuild-framework icon indicating copy to clipboard operation
easybuild-framework copied to clipboard

Fix `run_cmd` error handling

Open Flamefire opened this issue 3 years ago • 0 comments

Don't raise an error when log_ok=False is passed, i.e. the caller wants to handle the error.

The naming is confusing and the dependency on the strictness level is likely wrong. E.g. the caller may not expect a failing command to return from this function but to raise an error instead. However the user might have set the strictness to IGNORE which defeats the purpose of log_ok.

This change now allows to use log_all=True, log_ok=False to log the command and output and handle potential errors at the call site.

This is very likely the intended behavior, see e.g. https://github.com/easybuilders/easybuild-framework/blob/a8c0cad3acc5256735629b7dc94c143731ff650e/easybuild/framework/extension.py#L266-L267

Flamefire avatar Aug 23 '22 13:08 Flamefire