-
Notifications
You must be signed in to change notification settings - Fork 81
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
Fix issue with pngquant
and exit code 99
#71
Conversation
…han from error.code
…han from error.code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! (Gatsby maintainer here)
Forgive me - what is the best practice now? Should I close the pull request? |
Are there any updates on this PR? |
@davet42 I think a maintainer of So keep it open! |
@kevva @bradbaris maybe one of you could look at this PR, please? 🙂 |
The problem here was caused by d285e92. It upgraded the // @1000ch |
pngquant
and exit code 99
@sindresorhus Ah, sorry and thank you |
With recent updates to the image handling libraries in gatsby, routine image sharp operations started failing in builds. Here is an example issue in gatsby: gatsbyjs/gatsby#26723
Whenever a pngquant invocation cannot complete the requested transform (based on combination of the output and of the specified quality parameters), the binary returns a code of 99. Perhaps because of unrelated updates in node.js packages, I found that the existing validation using the "error.code" element did not work. Instead, the check should be performed on "error.exitCode".
This pull request makes a one line change (and adds comments - not sure if they follow the standards of the team but are provided for extra clarity). Through additional instrumentation in index.js, I was able to determine that the "error.code" parameter comes back as "undefined" in some cases when running on Ubuntu. It also comes back as EPIPE, which is often a signal that the socket connection is no longer there. In any case, the error.exitCode parameter does always seem to be correct.
I've run this using the gatsby setup on my project with a range of jpg and png images, using a variety of quality values. All appear to work with the change.
Changed this code (literally just error.code to error.exitCode):
To this:
I also changed the package version to 9.0.1 on logic that it is a non-breaking minor change.