On 5/30/25 12:54 AM, Shin'ichiro Kawasaki wrote:
diff --git a/check b/check index dad5e70..3cf741a 100755 --- a/check +++ b/check @@ -502,9 +502,9 @@ _check_and_call_test_device() { fi fi RESULTS_DIR="$OUTPUT/$(basename "$TEST_DEV")""$postfix" - if ! _call_test test_device; then - ret=1 - fi + _call_test test_device + # shellcheck disable=SC2181 + (($? != 0)) && ret=1
These alternatives may be easier to read than the above: if _call_test test_device; then :; else ret=1; fi if ! { _call_test test_device; }; then ret=1; fi Additionally, please add a comment that explains that ! should not be used directly because it causes set -e to be ignored in the called function.
@@ -695,9 +695,9 @@ _check() { if [[ $group != "$prev_group" ]]; then prev_group="$group" if [[ ${#tests[@]} -gt 0 ]]; then - if ! ( _run_group "${tests[@]}" ); then - ret=1 - fi + ( _run_group "${tests[@]}" ) + # shellcheck disable=SC2181 + (($? != 0)) && ret=1
Is the above change necessary? This command shows that the exclamation mark does not affect subshells: $ bash -c '!(set -e; false; echo set -e has been ignored)' $ Thanks, Bart.