@@ -47,26 +47,26 @@ For example:
4747
4848echo " $header "
4949
50+ tmpfile=$( mktemp)
51+ trap " rm -f $tmpfile " EXIT
52+
5053if [[ ${# files[@]} -eq 1 && " ${files[0]} " != * ' *' * ]]; then
51- # shellcheck disable=SC2086
52- # shellcheck disable=SC2068
53- java ${JAVA_OPTS} -jar " $executable " generate -c ${files[0]} ${args[@]}
54+ # shellcheck disable=SC2086
55+ # shellcheck disable=SC2068
56+ java ${JAVA_OPTS} -jar " $executable " generate -c ${files[0]} ${args[@]} 2>&1 | tee " $tmpfile "
57+ retcode=${PIPESTATUS[0]}
5458else
55- echo " Please press CTRL+C to stop or the script will continue in 5 seconds."
56- # sleep 5
57- if [ ${# files[@]} -eq 0 ]; then
58- files=(" ${root} " /bin/configs/* .yaml)
59- fi
59+ if [ ${# files[@]} -eq 0 ]; then
60+ files=(" ${root} " /bin/configs/* .yaml)
61+ fi
6062
61- # shellcheck disable=SC2086
62- # shellcheck disable=SC2068
63- if java ${JAVA_OPTS} -jar " $executable " batch ${BATCH_OPTS} --includes-base-dir " ${root} " --fail-fast -- ${files[@]} 2>&1 | tee /dev/pts/0 | grep -q -i " exception" ; then
64- echo " Found exception(s) when running the generator(s) to update the samples."
65- export GENERATE_ERROR=1
66- fi
63+ # shellcheck disable=SC2086
64+ # shellcheck disable=SC2068
65+ java ${JAVA_OPTS} -jar " $executable " batch ${BATCH_OPTS} --includes-base-dir " ${root} " --fail-fast -- ${files[@]} 2>&1 | tee " $tmpfile "
66+ retcode=${PIPESTATUS[0]}
6767fi
6868
69- if [[ -n " $GENERATE_ERROR " ]]; then
69+ if [[ $retcode -ne 0 ]] || grep -q -i " exception " " $tmpfile " ; then
7070 echo " Found exception(s) when running the generator(s) to update the samples."
7171 exit 1
7272fi
0 commit comments