aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-03-06 05:36:18 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-03-06 05:36:18 +0100
commitee80de959be80e382952fec36e11674fff6539d0 (patch)
tree41cf97fdac1aca266a75c7d3d76ca62a91707cf0
parentbd32b8f01b946a8856f2e1ab907122842447e11a (diff)
Fix error checking inside upload_all()HEADmaster
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
-rwxr-xr-xupload-artifact11
1 files 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
}