Skip to content

Commit

Permalink
better cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall authored Mar 6, 2025
1 parent 3324045 commit b2462fb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/libreoffice/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
set -eou pipefail

input_temp=$(mktemp /tmp/libreoffice-input-XXXXXX)
PDF="/app/$(basename "$input_temp").pdf"

cleanup() {
rm -rf "$input_temp" "$PDF"
}
trap cleanup EXIT

cat > "$input_temp"

libreoffice --headless --convert-to pdf "$input_temp" > /dev/null 2>&1

PDF="/app/$(basename "$input_temp").pdf"
cat "$PDF"

rm "$input_temp" "$PDF"

0 comments on commit b2462fb

Please sign in to comment.