mirror of
https://codeberg.org/leana8959/.files.git
synced 2026-02-01 14:39:39 +00:00
pacages/easyscan: trap EXIT and remove failed scans
This commit is contained in:
parent
297c03ad79
commit
09e7d1adb8
1 changed files with 8 additions and 3 deletions
|
|
@ -11,6 +11,13 @@ tempdir="$(mktemp -d)"
|
|||
filenames=()
|
||||
counter=1
|
||||
|
||||
function clean() {
|
||||
# Make sure I don't remove things other than pdf
|
||||
rm "$tempdir/"*.pdf
|
||||
rm -d "$tempdir"
|
||||
}
|
||||
trap clean EXIT
|
||||
|
||||
while :; do
|
||||
ok="true"
|
||||
echo "Scanning page $counter"
|
||||
|
|
@ -51,6 +58,4 @@ pdfunite "${filenames[@]}" "$merged_filename"
|
|||
mkdir -p "$(dirname "$OUTPUT_FILE")"
|
||||
cp "$merged_filename" "$OUTPUT_FILE"
|
||||
|
||||
# Make sure I don't remove things other than pdf
|
||||
rm "$tempdir/"*.pdf
|
||||
rm -d "$tempdir"
|
||||
clean
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue