We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 56427b8 commit 25a42eaCopy full SHA for 25a42ea
src/training/tesstrain_utils.sh
@@ -69,21 +69,14 @@ err_exit() {
69
# if the program file is not found.
70
# Usage: run_command CMD ARG1 ARG2...
71
run_command() {
72
- local cmd=$(which $1)
73
- if [[ -z ${cmd} ]]; then
74
- for d in api training; do
75
- cmd=$(which $d/$1)
76
- if [[ ! -z ${cmd} ]]; then
77
- break
78
- fi
79
- done
80
81
- err_exit "$1 not found"
82
83
+ local cmd
+ cmd=$(which $1 || \
+ for d in api training; do
+ which $d/$1 && break
+ done) || err_exit "'$1' not found"
84
shift
85
tlog "[$(date)] ${cmd} $@"
86
- if ! "${cmd}" "$@" 2>&1 1>&2 | tee -a ${LOG_FILE}; then
+ if ! "${cmd}" "$@" |& tee -a ${LOG_FILE}; then
87
err_exit "Program $(basename ${cmd}) failed. Abort."
88
fi
89
}
0 commit comments