Skip to content

Commit f2a2f7b

Browse files
fix(ssh): failed runtime downloads name the URL that failed
curl's HTTP error leaves out the URL and wget -q prints nothing, so a missing release or an unreachable mirror gave no clue what the remote bootstrap tried to fetch. t3_fetch now reports the URL and version before it exits. Timeouts and cleanup are unchanged. Based on #21170 by @jeprecated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 9c70a63 commit f2a2f7b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎packages/ssh/src/tunnel.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,14 @@ if ! t3_runtime_ready; then
499499
T3_ARCHIVE="t3-$T3_ARCHIVE_VERSION-$T3_PLATFORM-$T3_ARCH.tar.gz"
500500
T3_STAGING="$(mktemp -d "$HOME/.t3/runtime/versions/.staging-XXXXXX")"
501501
trap 'rm -rf "$T3_STAGING" "$T3_LOCK"' EXIT
502+
# curl's HTTP error omits the URL and wget -q prints nothing, so name what was not fetched.
502503
t3_fetch() {
503-
if command -v curl >/dev/null 2>&1; then curl -fsSL --connect-timeout 30 --max-time "$3" "$1" -o "$2"
504-
elif command -v wget >/dev/null 2>&1; then wget -q --timeout=30 --tries=1 "$1" -O "$2"
504+
if command -v curl >/dev/null 2>&1; then curl -fsSL --connect-timeout 30 --max-time "$3" "$1" -o "$2" && return
505+
elif command -v wget >/dev/null 2>&1; then wget -q --timeout=30 --tries=1 "$1" -O "$2" && return
505506
else printf 'Remote host needs curl or wget to download %s.\\n' "$T3_ARCHIVE" >&2; exit 1
506507
fi
508+
printf 'Could not download %s for t3 %s. Check that this release exists and the host can reach it.\\n' "$1" "$T3_ARCHIVE_VERSION" >&2
509+
exit 1
507510
}
508511
t3_fetch "$T3_RELEASE_BASE_URL/v$T3_ARCHIVE_VERSION/SHA256SUMS" "$T3_STAGING/SHA256SUMS" @@T3_ARCHIVE_CHECKSUMS_SECONDS@@
509512
t3_fetch "$T3_RELEASE_BASE_URL/v$T3_ARCHIVE_VERSION/$T3_ARCHIVE" "$T3_STAGING/$T3_ARCHIVE" @@T3_ARCHIVE_DOWNLOAD_SECONDS@@

0 commit comments

Comments
 (0)