Skip to content

Commit f1d9713

Browse files
trvrbclaude
andcommitted
upload-to-s3: fail early if the source file is unreadable
If $src can't be read, `tee < "$src"` fails and set -e aborts -- but the background sha256/wc readers, already blocked opening their fifos, never get a writer and leak (hang). Guard with `[[ -r "$src" ]]` before launching them, which also gives a clear error message. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 074429a commit f1d9713

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/upload-to-s3

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ main() {
2626
local dst="${2:?A destination s3:// URL is required as the second argument.}"
2727
local cloudfront_domain="${3:-}"
2828

29+
# Fail early if $src is unreadable. Otherwise `tee < "$src"` below fails, but
30+
# the background hasher/counter -- already blocked opening their fifos -- get
31+
# no writer and hang instead of being cleaned up.
32+
[[ -r "$src" ]] || { echo "upload-to-s3: cannot read source file: $src" >&2; exit 1; }
33+
2934
local s3path="${dst#s3://}"
3035
local bucket="${s3path%%/*}"
3136
local key="${s3path#*/}"

0 commit comments

Comments
 (0)