From e85e956701b81479eb4a1b1239024d9285b5fa93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Mon, 14 Jul 2025 16:18:49 +0200 Subject: [PATCH] packages/easyscan: ignore scanimage message --- nix/packages/by-name/easyscan/easyscan.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/nix/packages/by-name/easyscan/easyscan.sh b/nix/packages/by-name/easyscan/easyscan.sh index 8c8f9ef4..84d6996f 100644 --- a/nix/packages/by-name/easyscan/easyscan.sh +++ b/nix/packages/by-name/easyscan/easyscan.sh @@ -6,11 +6,15 @@ tempdir="$(mktemp -d)" counter=1 while :; do + ok="true" + echo "Scanning page $counter" + # If no size is set, the output will be wonky-sized # 210,297 is the size of A4 - scanimage -x 210 -y 297 --resolution 300 -o "$tempdir/easyscan_$counter.pdf" || + scanimage -x 210 -y 297 --resolution 300 -o "$tempdir/easyscan_$counter.pdf" >/dev/null 2>&1 || { echo "Failed to scan page..." + ok="false" } IFS= read -r -p "Continue scanning? [Y/n] " cont @@ -19,9 +23,12 @@ while :; do echo "Exiting..." break ;; - [yY] | *) ;; + [yY] | *) + if $ok; then + counter=$((counter += 1)) + fi + ;; esac - counter=$((counter += 1)) done # Multiple files are scanned, join them