From d7edaa9c9828e0c6340d700df96c41d7d1251b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20A=2E=20Bellone?= Date: Wed, 24 Jul 2024 21:07:14 -0300 Subject: [PATCH 1/2] Use a loop instead of `mapfiles` to read URLs --- hooks/pre-exit | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hooks/pre-exit b/hooks/pre-exit index de8bf7f..13ce272 100755 --- a/hooks/pre-exit +++ b/hooks/pre-exit @@ -47,7 +47,8 @@ fi # Creates the annotations with all the report URLs annotation-link() { local json_file="$1" - mapfile -t REPORT_URLS < <(sort "${json_file}" | uniq) + REPORT_URLS=() + while IFS= read -r line; do REPORT_URLS+=("${line}"); done < <(sort "${json_file}" | uniq) local REPORTS="" REPORT_COUNT=1 @@ -252,4 +253,4 @@ else fi if [ "$ANNOTATE" != "false" ]; then annotation-link "${REPORT_URLS_FILE}" -fi \ No newline at end of file +fi From 811deb3ab4337a14a5a9d44b5ff59fefff84bff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20A=2E=20Bellone?= Date: Wed, 24 Jul 2024 21:08:24 -0300 Subject: [PATCH 2/2] Redirect stderr of kill command to stdout --- hooks/pre-exit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/pre-exit b/hooks/pre-exit index 13ce272..33dc720 100755 --- a/hooks/pre-exit +++ b/hooks/pre-exit @@ -190,7 +190,7 @@ find_and_upload() { for index in "${!uploads_in_progress[@]}"; do # Note: kill -0 does not kill the pid, it provides a *nix compatible way to test the pid is responding. - if ! kill -0 "${uploads_in_progress[index]}" > /dev/null; then + if ! kill -0 "${uploads_in_progress[index]}" > /dev/null 2>&1; then unset 'uploads_in_progress[index]' elif [[ "$iterations_waited" -gt $TIMEOUT ]]; then echo "Upload '${uploads_in_progress[index]}' has been running for more than '${TIMEOUT}' seconds, killing it"