Skip to content

Commit

Permalink
bash: Move the check for the existence of the temporary directory for…
Browse files Browse the repository at this point in the history
… clean-up to the clean-up function itself
  • Loading branch information
JussiPekonen committed Aug 10, 2020
1 parent 0290f3c commit 4d5a1e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions bash/src/bib2web.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ checkResultAndAbortIfNeeded() {
local result="$1"
if [ "${result}" -gt 0 ]; then
echo "Aborting..." >&2
if [ "${BIB2WEB_TMP_DIR}" ] && [ -e "${BIB2WEB_TMP_DIR}" ]; then
cleanUp
fi
cleanUp
exit "${result}"
fi
}
Expand Down
4 changes: 3 additions & 1 deletion bash/src/preprocessor.bash
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ setUpFiles() {

# Clean-up
cleanUp() {
"${BIB2WEB_RM}" -rf "${BIB2WEB_TMP_DIR}"
if [ "${BIB2WEB_TMP_DIR}" ] && [ -e "${BIB2WEB_TMP_DIR}" ]; then
"${BIB2WEB_RM}" -rf "${BIB2WEB_TMP_DIR}"
fi
verbose "Done!"
}

0 comments on commit 4d5a1e0

Please sign in to comment.