I have a ghostscript command, when the file I input is wrong, ghostscript fail and print a error message.
So far so good, I do a simple script apply the command on multiple files, and tell me how many files failed.
But ghostscript print error on stdout, and nothing to stdout.
While searching, I found the -sstdout
flag, but in that case, everything goes to stderr and nothing to stdout.
Is there a way to simply and programatically tell if ghostscript encountered a error?
(A ugly workaround would be to search for 'error' in stdout, but that s just plain bad).
Is there a way to tell ghostscript to use stdout and stderr like thoses are supposed to be used? For separate standard and error output?
I ve found another workaround, since I don t need stdout, I added the flags -q -sstdout=%stderr
.
-q
suspress all non error message (in my case)
-sstdout=%stderr
redirect stdout to stderr, in my case it mean the error messages.