packages: add a trap to cleanup after snapshot script
What
This MR adds a safeguard for the snapshot script to cleaup temporary files in case of error.
Why
How
Manually testing the MR
To check if the trap works you need to simulate a failoure. Instead of running the script itself, you can run this mockup:
#!/bin/sh
touch /tmp/file
trap 'rm -f /tmp/file' EXIT
echo "This is a test."
exit 1
echo "This won't be reached if an error occurs."
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR