convert always has exit code 0 (success) even if failed
Posted: 2018-08-10T04:07:55-07:00
I'm writing a script to recursively test JPGs for corruption using imagemagick to open and resize the image.
And on testing the error codes returned on a known bad jpg I always get a "0" success.
convert -resize 100 BNE4_0288.jpg /tmp/out.jpg
gives me a 0.
if I check out.jpg it's truncated and mostly grey. Sure it was made, but I wouldn't call that a '0'.
Can this be assigned a non-zero error code?
And on testing the error codes returned on a known bad jpg I always get a "0" success.
convert -resize 100 BNE4_0288.jpg /tmp/out.jpg
echo $?convert-im6.q16: Corrupt JPEG data: found marker 0xea instead of RST5 `BNE4_0288.jpg' @ warning/jpeg.c/JPEGWarningHandler/352.
convert-im6.q16: Corrupt JPEG data: found marker 0xea instead of RST6 `BNE4_0288.jpg' @ warning/jpeg.c/JPEGWarningHandler/352.
convert-im6.q16: Corrupt JPEG data: found marker 0xea instead of RST7 `BNE4_0288.jpg' @ warning/jpeg.c/JPEGWarningHandler/352.
convert-im6.q16: Corrupt JPEG data: found marker 0xea instead of RST0 `BNE4_0288.jpg' @ warning/jpeg.c/JPEGWarningHandler/352.
convert-im6.q16: Corrupt JPEG data: found marker 0xea instead of RST1 `BNE4_0288.jpg' @ warning/jpeg.c/JPEGWarningHandler/352.
ETC!!
gives me a 0.
if I check out.jpg it's truncated and mostly grey. Sure it was made, but I wouldn't call that a '0'.
Can this be assigned a non-zero error code?