From 60091f44ebe5809ac2050b2efde28150faf7a7a0 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 18 Jan 2020 08:43:45 +0000 Subject: [PATCH] if [ $(file -b --mime-type database/$INPUTBASENAME/screenshot.png) != "image/png" ] ; then --- code/worker.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/worker.sh b/code/worker.sh index 28bdccff..1472d284 100644 --- a/code/worker.sh +++ b/code/worker.sh @@ -292,8 +292,16 @@ xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]] kill $APID && printf "\n\n\n* * * SUCCESS :-) * * *\n\n\n" || exit 1 killall icewm -# Check if the screenshot is empty and error out if it is -[ -s database/$INPUTBASENAME/screenshot.png ] || echo "Screenshot is empty" && exit 1 +# Check if the screenshot is unusable and error out if it is +if [ $(file -b --mime-type database/$INPUTBASENAME/screenshot.png) != "image/png" ] ; then + echo "Could not take a screenshot png file" + ls -lh database/$INPUTBASENAME/screenshot.png + file database/$INPUTBASENAME/screenshot.png + file -b --mime-type database/$INPUTBASENAME/screenshot.png + exit 1 +fi + +# [ -s database/$INPUTBASENAME/screenshot.png ] || echo "Screenshot is empty" && exit 1 echo "==========================================="