From d9711114c3130d690760fc501b58168087a6a3bb Mon Sep 17 00:00:00 2001 From: Shane da Silva Date: Thu, 31 Oct 2024 13:57:20 -0700 Subject: [PATCH] fix: Remove temporary files after script exit (#2393) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why is this change needed? We don't need to keep the temporary files around after the script has run. Remove them after script termination. Suggested in #2356. ## Merge Checklist - [x] PR title adheres to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard - [ ] PR has a [changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets) - [ ] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore) - [ ] PR includes [documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs) if necessary. --- ## PR-Codex overview This PR introduces a cleanup mechanism in the `scripts/hubble.sh` file to ensure that a temporary file is removed upon script exit. ### Detailed summary - Added a `trap` command to remove the temporary file (`tmp_file`) when the script exits, ensuring no leftover files remain after execution. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- scripts/hubble.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/hubble.sh b/scripts/hubble.sh index 81bddf422d..bf38d81a45 100755 --- a/scripts/hubble.sh +++ b/scripts/hubble.sh @@ -84,6 +84,7 @@ self_upgrade() { fi local tmp_file + trap 'rm -f "$tmp_file"' EXIT tmp_file=$(mktemp) fetch_file_from_repo "$SCRIPT_FILE_PATH" "$tmp_file"