Merge "borg-backup: save PIPESTATUS before referencing"

This commit is contained in:
Zuul 2021-02-10 03:01:08 +00:00 committed by Gerrit Code Review
commit 8d127946bc
1 changed files with 5 additions and 4 deletions

View File

@ -43,12 +43,13 @@ do
bash $f | ${BORG_CREATE} --stdin-name ${stream_name} \
::"{hostname}-${stream_name}-{now}" -
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
_status=( "${PIPESTATUS[@]}" )
if [[ ${_status[0]} -ne 0 ]]; then
info "Streaming script ${f} failed!"
stream_exit=${PIPESTATUS[0]}
elif [[ ${PIPESTATUS[1]} -ne 1 ]]; then
stream_exit=${_status[0]}
elif [[ ${_status[1]} -ne 1 ]]; then
info "Borg failed!"
stream_exit=${PIPESTATUS[1]}
stream_exit=${_status[1]}
else
stream_exit=0
fi