Is it possible for convert to return a "-1" ?
A friend of mine is using Cygwin's 6.4.0 version of ImageMagick to run the convert program, and apparently receives a "-1" return code from convert.
After some searching, it appears the ImageMagick programs only return a 0 (success) or a 1 (failure). So I am guessing his "-1" return code is coming from the Windows OS or the Windows convert.exe program. I could not find anything in google about a negative return code from ImageMagick, though I did see some Exception codes listed that had values greater than 1.
Is it correct to say that convert itself only returns a 0 or 1?
What I found so far:
http://www.imagemagick.org/script/exception.php
viewtopic.php?f=3&t=12115
viewtopic.php?f=1&t=8571&start=0
Is it possible for convert to return a "-1" ?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Is it possible for convert to return a "-1" ?
There should not be any such return code period.
this is nothing to do with Image Magick but UNIX command line handling. Return codes are purely a number from 0 to 255. However on top of this the Exec System Library Call adds another 8 bit code above that whcih defines interupt or crash codes from programs.
As such a caller may get a 16 bit return value of #FFFF, and a BAD shell may report that as being a value of -1.
It is NOT -1. It is a value of 65535 or a interupted command with a return code of 255.
Basically -1 is a nonsense return from a bad shell on a program that crashed in some way. At least under UNIX.
What it means under DOS I have no idea! but it is either a bad thing or something to just ignore.
this is nothing to do with Image Magick but UNIX command line handling. Return codes are purely a number from 0 to 255. However on top of this the Exec System Library Call adds another 8 bit code above that whcih defines interupt or crash codes from programs.
As such a caller may get a 16 bit return value of #FFFF, and a BAD shell may report that as being a value of -1.
It is NOT -1. It is a value of 65535 or a interupted command with a return code of 255.
Basically -1 is a nonsense return from a bad shell on a program that crashed in some way. At least under UNIX.
What it means under DOS I have no idea! but it is either a bad thing or something to just ignore.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Is it possible for convert to return a "-1" ?
When ImageMagick has an error, say convert is called with a non-existent file as input, does it display a message saying what the error is, and then return a "1" ?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Is it possible for convert to return a "-1" ?
don't know if this is what you want, but see -regard-warnings at http://www.imagemagick.org/Usage/basics/#controls
Re: Is it possible for convert to return a "-1" ?
Thanks, we will try using "convert -quiet -regard-warnings...". When I googled -regard-warnings, it seems it is generally used with "-quiet", so we will try them together.
Or are you suggesting just use the "-regard-warnings" ?
Or are you suggesting just use the "-regard-warnings" ?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Is it possible for convert to return a "-1" ?
if you want to see the error message, leave off -quiet; otherwise if you include it is suppresses the actual error and you can then create you own message, such as
convert -quiet -regard-warnings "$infile" +repage $dir/tmpI.mpc ||
echo "--- FILE $infile DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---"
see the link above provided earlier
convert -quiet -regard-warnings "$infile" +repage $dir/tmpI.mpc ||
echo "--- FILE $infile DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---"
see the link above provided earlier