summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jh-checksource.sh5
1 files changed, 2 insertions, 3 deletions
diff --git a/jh-checksource.sh b/jh-checksource.sh
index 9e3a9d6..7ebb04e 100644
--- a/jh-checksource.sh
+++ b/jh-checksource.sh
@@ -58,6 +58,8 @@ main() {
# Init
unsafe_files="$(mktemp)"
+ cleanup() { rm -f -- "$unsafe_files"; }
+ trap cleanup EXIT
# Heavy lifting
find . -type f -printf '%s %h/%f\n' | # find all files
@@ -82,10 +84,7 @@ main() {
if [[ -n "$(cat "$unsafe_files")" ]]; then
<"$unsafe_files" sort | print-$format
- rm -f "$unsafe_files"
exit 1
- else
- rm -f "$unsafe_files"
fi
}