Skip to content

Commit 5825335

Browse files
authored
Fix Hanging on Skip All (#17)
1 parent ed323fb commit 5825335

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default (options = {}) => {
5656
// Map them into jimp objects
5757
images
5858
.filter((d) => d.indexOf('@') < 0 && d.indexOf('#') < 0)
59-
.forEach((image) => {
59+
.forEach((image, index, imageArray) => {
6060
// generate the output path
6161
const imagePathSplit = image.split('.');
6262
const imagePathPre = imagePathSplit.slice(0, -1).join('.');
@@ -88,7 +88,12 @@ export default (options = {}) => {
8888
);
8989

9090
// if images already exist, we can skip this rest of this process
91-
if (outputs.length === 0) return;
91+
if (outputs.length === 0) {
92+
// If every single file is skipped, we still need to resolve
93+
// so that promise-queue doesn't sit around waiting forever.
94+
if (index === imageArray.length - 1) q.add(() => Promise.resolve());
95+
return;
96+
}
9297
}
9398

9499
// ////////////////////////////////////////////

0 commit comments

Comments
 (0)