|
|
@ -27,7 +27,9 @@ function exit { |
|
|
|
|
|
|
|
|
# MAIN |
|
|
# MAIN |
|
|
|
|
|
|
|
|
# TODO: take attention to argument like -x or --debug, then shift! |
|
|
|
|
|
|
|
|
opt_debug="" |
|
|
|
|
|
[[ $1 == '-x' || $1 == '--debug' ]] && opt_debug="-x" && shift |
|
|
|
|
|
|
|
|
command=$1 |
|
|
command=$1 |
|
|
shift |
|
|
shift |
|
|
original_args=("$@") |
|
|
original_args=("$@") |
|
|
@ -37,6 +39,10 @@ for i in "${original_args[@]}"; do quoted_args+=("${i@Q}"); done |
|
|
set -TEue -o pipefail |
|
|
set -TEue -o pipefail |
|
|
export -f exit |
|
|
export -f exit |
|
|
# echo PROCESS START |
|
|
# echo PROCESS START |
|
|
bash -c "set -TEue -o pipefail; trap 'exit \$? $TMP_ERROR' ERR TERM INT EXIT; source $command ${quoted_args[*]}" 3>&1 1>&2 2>&3 | tee $TMP_ERROR |
|
|
|
|
|
|
|
|
bash $opt_debug -c " |
|
|
|
|
|
set -TEue -o pipefail; |
|
|
|
|
|
trap 'exit \$? $TMP_ERROR' ERR TERM INT EXIT; |
|
|
|
|
|
source $command ${quoted_args[*]} |
|
|
|
|
|
" 3>&1 1>&2 2>&3 | tee $TMP_ERROR |
|
|
# echo PROCESS END succesfully |
|
|
# echo PROCESS END succesfully |
|
|
|
|
|
|