(#7244) Fix test for non-zero-or-1 exit status