Skip to content

fix: add trap handlers for tmpfile cleanup in installers#10

Open
boffin-dmytro wants to merge 2 commits intomainfrom
fix/installer-tmpfile-cleanup
Open

fix: add trap handlers for tmpfile cleanup in installers#10
boffin-dmytro wants to merge 2 commits intomainfrom
fix/installer-tmpfile-cleanup

Conversation

@boffin-dmytro
Copy link
Copy Markdown
Owner

Summary

Adds proper trap handlers to ensure temporary files are cleaned up even if installer phases are interrupted.

Changes

  • installers/phases/05-docker.sh: Add trap handler for Docker install script cleanup
  • installers/phases/07-devtools.sh: Add trap handlers for Node.js and OpenCode install script cleanup

Problem Solved

Temporary files created during installer phases could be left behind if:

  • User interrupts installation (Ctrl+C)
  • Network timeout causes script termination
  • System receives TERM signal during installation

Benefits

  • Resource cleanup: Prevents /tmp pollution from interrupted installs
  • Security: Removes potentially sensitive install scripts from filesystem
  • Reliability: Ensures clean state for retry attempts

Implementation

Uses trap 'rm -f "$tmpfile"' EXIT INT TERM pattern to handle:

  • EXIT: Normal script completion (success or failure)
  • INT: User interruption (Ctrl+C)
  • TERM: System termination signal

@boffin-dmytro boffin-dmytro force-pushed the main branch 2 times, most recently from 5a4c90a to 28da306 Compare March 19, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant