From ee80de959be80e382952fec36e11674fff6539d0 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Fri, 6 Mar 2026 05:36:18 +0100 Subject: Fix error checking inside upload_all() Because of historical reason, set -e is ignored inside function bodies [1], which caused the script to attempt to share a file even if the upload had failed. [1]: https://lists.gnu.org/archive/html/bug-bash/2012-12/msg00094.html --- upload-artifact | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/upload-artifact b/upload-artifact index f10aad7..328bb4e 100755 --- a/upload-artifact +++ b/upload-artifact @@ -70,8 +70,15 @@ upload_all() for f in $* do - upload -d "$dir" "$f" || (printf "Failed to upload %s\n" "$f"; exit 1) - share -d "$dir" "$f" || (printf "Failed to share %s\n" "$f"; exit 1) + if ! upload -d "$dir" "$f" + then + printf "Failed to upload %s\n" "$f" + exit 1 + elif ! share -d "$dir" "$f" + then + printf "Failed to share %s\n" "$f" + exit 1 + fi done } -- cgit v1.2.3