The _install function will fail pretty messily in case of a number of errors, but particularly in case of the download failing.
|
curl -L "$download_link" > "$tempfile" |
|
dirname=$(tar tzf "$tempfile" | head -1 | cut -f1 -d'/') |
|
cd "$RGBENV_VERSIONS" |
|
tar xzf "$tempfile" |
|
|
|
mv "$RGBENV_VERSIONS/$dirname" "$RGBENV_VERSIONS/$RGBDS_PREFIX$version" |
|
trap - ERR |
|
rm -f "${tempfile}" |
|
|
|
# then build it |
|
echo "Building RGBDS $version..." |
|
cd "$RGBENV_VERSIONS/$RGBDS_PREFIX$version" |
|
if make; then |
if $tempfile is not a valid tarball, i.e. if the download fails:
tar -t will fail
$dirname will be empty, ideally
tar -x will fail
mv will fail, trying to move the versions directory into itself
cd will fail
make will be invoked in the version directory, probably "no makefile found" error
- a message will be printed saying that "You may still use this version, just with missing tools."
The most basic thing to add would be checking tar's exit status, which would catch a lot of potential problems.
The _install function will fail pretty messily in case of a number of errors, but particularly in case of the download failing.
rgbenv/rgbenv
Lines 334 to 346 in 2515774
if
$tempfileis not a valid tarball, i.e. if the download fails:tar -twill fail$dirnamewill be empty, ideallytar -xwill failmvwill fail, trying to move the versions directory into itselfcdwill failmakewill be invoked in the version directory, probably "no makefile found" errorThe most basic thing to add would be checking
tar's exit status, which would catch a lot of potential problems.