Detect launcher download error earlier

(and clean up failed downloads)
This commit is contained in:
Conny Brunnkvist 2021-09-13 18:35:31 +07:00 committed by GitHub
parent f4555e8682
commit 97247845fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

9
sbt
View File

@ -116,13 +116,20 @@ jar_url () {
download_url () {
local url="$1"
local jar="$2"
local exit_code
mkdir -p $(dirname "$jar") && {
if command -v curl > /dev/null; then
curl --fail --silent -L "$url" --output "$jar"
exit_code=$?
elif command -v wget > /dev/null; then
wget --quiet -O "$jar" "$url"
exit_code=$?
fi
} && [[ -f "$jar" ]]
$(exit "$exit_code") && [[ -f "$jar" ]]
} || {
echoerr "Error while fetching ${url}"
rm -f "$jar"
}
}
acquire_sbt_jar () {