On Thu, 12 Jun 2025 11:05:14 +0900 Yuyang Huang wrote: > +VERBOSE=0 > +PAUSE=no > +PAUSE_ON_FAIL=no > + > +source lib.sh > + > +# set global exit status, but never reset nonzero one. > +check_err() > +{ > + if [ $ret -eq 0 ]; then > + ret=$1 > + fi > + [ -n "$2" ] && echo "$2" > +} > + > +run_cmd_common() > +{ > + local cmd="$*" > + local out > + if [ "$VERBOSE" = "1" ]; then > + echo "COMMAND: ${cmd}" > + fi > + out=$($cmd 2>&1) > + rc=$? > + if [ "$VERBOSE" = "1" -a -n "$out" ]; then > + echo " $out" > + fi > + return $rc > +} > + > +run_cmd() { > + run_cmd_common "$@" > + rc=$? > + check_err $rc > + return $rc > +} > + > +end_test() > +{ > + echo "$*" > + [ "${VERBOSE}" = "1" ] && echo > + > + if [[ $ret -ne 0 ]] && [[ "${PAUSE_ON_FAIL}" = "yes" ]]; then > + echo "Hit enter to continue" > + read a > + fi; > + > + if [ "${PAUSE}" = "yes" ]; then > + echo "Hit enter to continue" > + read a > + fi > + > +}
Perhaps move these to lib.sh as a separate commit? They seem generic. Please fix the shellcheck warnings. The "info"-level messages are up you, SC2317 can be ignored. -- pw-bot: cr