Files
linux-kernel-module-cheat/eeval
Ciro Santilli 626f5f9e22 bench-boot: add -f option to only run fast boots
Comment out all tests that are known to be failing.

run: exit 1 on failure, was broken dude to termout pipe
2018-08-13 22:56:20 +01:00

27 lines
670 B
Bash
Executable File

#!/usr/bin/env bash
# echo and eval
set -e
a=
while getopts a OPT; do
case "$OPT" in
a)
# Append to file instead of overwriting.
a=-a
;;
?)
exit 2
;;
esac
done
shift "$(($OPTIND - 1))"
cmd="$1"
outfile="${2:-/dev/null}"
mkdir -p "$(dirname "$outfile")"
echo "$cmd" | tee $a "$outfile"
# PIPESTATUS so that cmd="main_cmd | post_process" will return the status of cmd.
# Not POSIX.
# https://unix.stackexchange.com/questions/14270/get-exit-status-of-process-thats-piped-to-another
# https://stackoverflow.com/questions/1221833/pipe-output-and-capture-exit-status-in-bash
eval "${cmd}; cmd_exit=\${PIPESTATUS[0]}"
exit "$cmd_exit"