5 PLATAL_ROOT
=${CRONDIR}/..
/..
7 # Executes a command and displays its output only if retcode != 0
8 # @param dir Folder from which the command should be called
9 # @param cmd The command to execute
10 # After execution, the pwd is returned to its initial value.
11 function print_if_err
{
12 local dir cmd retcode tmpfile
16 echo "* Running ${cmd}..."
17 # Capture output and return code
18 tmpfile
=$
(mktemp pl_run_tests.XXXXXX
)
19 cd ${dir} && ${cmd} 2>&1 > ${tmpfile}
22 if [ "x${retcode}" != "x0" ]; then
23 echo "** Error running command ${cmd} (code ${retcode})"
34 print_if_err
${PLATAL_ROOT} "make test"