mirror of https://github.com/sbt/sbt.git
[2.x] fix: Add --fail to curl in launcher to prevent corrupt jars (#9003)
When the download URL returns an HTTP error (e.g. 404), curl without --fail exits 0 and saves the error page HTML as the jar file. This leaves a corrupt jar that causes confusing errors on subsequent runs. With --fail, curl returns a non-zero exit code on HTTP errors and does not write the response body to the output file. Fixes #6654 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7218b2a1ac
commit
00632754ab
2
sbt
2
sbt
|
|
@ -142,7 +142,7 @@ download_url () {
|
||||||
local jar="$2"
|
local jar="$2"
|
||||||
mkdir -p $(dirname "$jar") && {
|
mkdir -p $(dirname "$jar") && {
|
||||||
if command -v curl > /dev/null; then
|
if command -v curl > /dev/null; then
|
||||||
curl --silent -L "$url" --output "$jar"
|
curl --fail --silent -L "$url" --output "$jar"
|
||||||
elif command -v wget > /dev/null; then
|
elif command -v wget > /dev/null; then
|
||||||
wget --quiet -O "$jar" "$url"
|
wget --quiet -O "$jar" "$url"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue