Extract zip into temp dir to prevent leftover files on sudo cancel#13
Merged
albertodebortoli merged 2 commits intomainfrom May 1, 2026
Merged
Extract zip into temp dir to prevent leftover files on sudo cancel#13albertodebortoli merged 2 commits intomainfrom
albertodebortoli merged 2 commits intomainfrom
Conversation
If the user cancelled the sudo password prompt during installation, the extracted binary was left behind in the current working directory. Using a temp directory (mktemp -d) with an EXIT trap ensures all intermediate files are cleaned up unconditionally regardless of how the script exits.
The mock was hardcoding ./Luca as the output path. Now it parses the -d argument so it correctly places the binary in the temp directory used by install.sh after the extraction refactor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mktemp -dtemp directory instead of the current working directoryEXITtrap (rm -rf "$TEMP_DIR") so the temp directory is always cleaned up, regardless of how the script exitsrmof the zip file and the "Cleaned up temporary files" echoProblem
When
install.shprompted for a sudo password (tomvthe binary into/usr/local/bin) and the user cancelled, the extracted binary (Lucaorluca) was left behind in whatever directory the script was run from.Test plan
install.sh, cancel the sudo prompt → confirm noLuca/lucabinary is left in CWDinstall.shnormally → confirm Luca installs correctly to/usr/local/bininstall.shagain with same version → confirm the already-up-to-date early-exit path still works