2022-12-01 10:23:49 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function g_runcmd {
|
2022-12-01 15:01:42 +01:00
|
|
|
set -o pipefail
|
2023-01-17 10:18:11 +01:00
|
|
|
#>&2 echo "running $@"
|
2022-12-01 15:01:42 +01:00
|
|
|
$@ 2>&1 | tee $g_tmp/g_runcmd-output
|
2022-12-01 10:23:49 +01:00
|
|
|
g_runcmd_exitcode=$?
|
2022-12-01 10:29:21 +01:00
|
|
|
|
2022-12-01 15:01:42 +01:00
|
|
|
if ! [ $g_runcmd_exitcode -eq 0 ]
|
2022-12-01 10:23:49 +01:00
|
|
|
then
|
2023-01-17 10:30:16 +01:00
|
|
|
g_echo_error "${FUNCNAME} $@
|
2022-12-01 15:01:42 +01:00
|
|
|
$(cat $g_tmp/g_runcmd-output)"
|
2022-12-01 10:23:49 +01:00
|
|
|
fi
|
|
|
|
return $g_runcmd_exitcode
|
|
|
|
}
|