Skip to content

Commit

Permalink
feat: remove temp file upon error on downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoomTen committed Jun 21, 2024
1 parent 158abe9 commit 876af32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rgbenv
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,15 @@ _install () {
# if so, download the tarball and extract it
echo "Downloading from $download_link..."
tempfile=$(mktemp)
trap "rm -f \"${tempfile}\"" ERR
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"
rm "$tempfile"
trap - ERR
rm -f "${tempfile}"

# then build it
echo "Building RGBDS $version..."
Expand Down

0 comments on commit 876af32

Please sign in to comment.