From c8e1546ce23b7fa3761a2ad3c32f16c261009d46 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 9 Sep 2020 06:45:51 -0400 Subject: [PATCH] Fix issue with `pngquant` and exit code 99 (#71) Co-authored-by: Dave Thompson Co-authored-by: Sindre Sorhus --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c564e97..c80cb9d 100644 --- a/index.js +++ b/index.js @@ -63,7 +63,9 @@ const imageminPngquant = (options = {}) => input => { const promise = subprocess .then(result => result.stdout) // eslint-disable-line promise/prefer-await-to-then .catch(error => { - if (error.code === 99) { + // We use `error.exitCode` to check for a special condition when running the pngquant binary. + // See details on handling of "99" code at https://pngquant.org (search for "status code 99"). + if (error.exitCode === 99) { return input; }