„gaboshlib/g_runcmd.bashfunc“ ändern

This commit is contained in:
olli 2022-12-01 15:01:42 +01:00
parent 94cc0f01ef
commit a5d5169992

View File

@ -1,15 +1,15 @@
#!/bin/bash #!/bin/bash
function g_runcmd { function g_runcmd {
set -o pipefail
g_echo "running $@" g_echo "running $@"
$@ 2>&1 | tee $g_tmp/g_runcmd-output $@ 2>&1 | tee $g_tmp/g_runcmd-output
g_runcmd_exitcode=$? g_runcmd_exitcode=$?
if [ $g_runcmd_exitcode -eq 0 ] if ! [ $g_runcmd_exitcode -eq 0 ]
then then
g_echo_ok "$@" g_echo_error "# $@
else $(cat $g_tmp/g_runcmd-output)"
g_echo_error "$@"
fi fi
return $g_runcmd_exitcode return $g_runcmd_exitcode
} }