Skip to content

Commit

Permalink
Use trap for cleaning up temp file
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalossilva committed May 24, 2023
1 parent db3b9da commit 464a770
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/detekt/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
printf "Running detekt...\r"

OUTPUT="/tmp/detekt-$(date +%s)"
trap 'rm -f "$OUTPUT"' EXIT

./gradlew :resources-plugin:detekt :resources-library:detekt detekt -PautoCorrect=true > "$OUTPUT"
EXIT_CODE=$?

Expand All @@ -13,5 +15,4 @@ if [ $EXIT_CODE -ne 0 ]; then
echo "*********************************************"
fi

rm "$OUTPUT"
exit $EXIT_CODE

0 comments on commit 464a770

Please sign in to comment.