Skip to content

Commit 0c4efe2

Browse files
authored
fix(install): name the temp directory when the download can't be written (#59312)
1 parent d8607b6 commit 0c4efe2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎install‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,15 @@ download_and_install() {
311311

312312
if [[ "$os" == "windows" ]] || ! [ -t 2 ] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
313313
# Fallback to standard curl on Windows, non-TTY environments, or if custom progress fails
314-
curl -f -# -L -o "$tmp_dir/$filename" "$url"
314+
local ret=0
315+
curl -f -# -L -o "$tmp_dir/$filename" "$url" || ret=$?
316+
# curl exits 23 when it cannot write the file, usually because the temporary directory is full.
317+
if [ "$ret" -eq 23 ]; then
318+
print_message error "Could not write the download to $tmp_dir. Make sure it has enough free space, or set TMPDIR to another directory, then try again." >&2
319+
fi
320+
if [ "$ret" -ne 0 ]; then
321+
exit "$ret"
322+
fi
315323
fi
316324

317325
tar -xzf "$tmp_dir/$filename" -C "$tmp_dir"

0 commit comments

Comments
 (0)