Skip to content

Commit

Permalink
use tee instead of bash redirection
Browse files Browse the repository at this point in the history
for better error handling
  • Loading branch information
adrelanos committed Aug 30, 2023
1 parent 7ee2a27 commit 6c5ef03
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions usr/libexec/systemcheck/canary
Expand Up @@ -5,6 +5,7 @@

#set -x
set -e
set -o pipefail

error_handler() {
echo "ERROR: BASH_COMMAND: $BASH_COMMAND | exit_code: $?"
Expand Down Expand Up @@ -178,8 +179,8 @@ canary_do() {

timeout --kill-after="5" "180" \
/usr/libexec/systemcheck/canary-download \
"$canary_api_link" \
&> "/var/lib/canary/canary-download-output.txt" \
"$canary_api_link" 2>&1 \
| tee "/var/lib/canary/canary-download-output.txt" > /dev/null\
|| { canary_download_exit_code="$?" ; true; };

if [ ! "$canary_download_exit_code" = "0" ]; then
Expand Down

0 comments on commit 6c5ef03

Please sign in to comment.