Page 1 of 1

'convert' exit status is zero (success) when arguments are not understood

Posted: 2015-10-15T13:43:02-07:00
by spookylukey
If you pass too few arguments to convert:

Code: Select all

convert rubbishrubbish
it prints help, but exits with status code 0, indicating success.

This is obviously really bad behaviour, especially for scripts which rely on error codes.

So far I've only found this happening when you fail to pass enough arguments, but perhaps there are other ways to trigger this too. It works correctly if you pass an option that doesn't exist.

Re: 'convert' exit status is zero (success) when arguments are not understood

Posted: 2015-10-15T13:44:51-07:00
by spookylukey
Forgot version numbers:
> convert -version
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
Running on Linux Mint.

Re: 'convert' exit status is zero (success) when arguments are not understood

Posted: 2015-10-15T13:52:24-07:00
by dlemstra
The current version of ImageMagick (6.9.2-4) does not have this kind of behavior. It set the exit status to '1' with your command. I would suggest you to upgrade to a more recent version. Your version is over 3 years old.