-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling errors in stream mode #256
Comments
hmmm that would be a bug. errors should be buffered and returned as an |
Unless I am mistaken, fixing this issue will require a change to the API. The problem is that the only way Assuming this is correct, would it be acceptable to either pass the |
We've been hitting this as well using gm 1.16.0. Two variations:
|
I hit the same issue. Agree with @kevinoid , simplest fix is pass the When the stream is buffered, this is already handled by the Change would be non-breaking and can serve as a workaround, since this issue is otherwise very serious. The stream() API method is a bit dangerous now as it stands, since it seems that on failures you might be left listening for events on the streams forever. |
Is anyone still following this issue? I opened a patch at #647. Would appreciate extra eyes! |
Hello!
Suppose the following image operation:
var stream = gm('piano.png').crop(100, 100, 0, 0).stream('jpg')
How can I be notified of processing errors (such as if "piano.png" couldn't be opened)?
I've tried the alternative:
gm('piano.png').crop(100, 100, 0, 0).stream('jpg', function (err, stdout, stderr) {...})
Even in "piano.png" doesn't exists, the err parameter in the callback is null (that is expected).
If I attach a data event listener on stream stderr, I'm able to receive error messages - and detect processing errors.
But I've tried with a PNG file (http://www.iphonestheme.com/uploads/allimg/130206/1-1302061353440-L.png), and although the image was successfully processed, I still got some warnings coming from the stderr stream:
convert: iCCP: known incorrect sRGB profile `/Users/rgermano/iG/workspaces/iglr-app/test/resources/img-validator/piano_600x1636.png' @ warning/png.c/MagickPNGWarningHandler/1830.
Is there an approach using streams to catch processing errors only (not warnings)?
Thanks!
Ricardo
The text was updated successfully, but these errors were encountered: