Skip to content

Commit

Permalink
builder: Fix unawaited buildDir pack() promise
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
thgreasi committed Nov 9, 2023
1 parent f1f0eac commit 76a9cec
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions lib/build/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,23 @@ export default class Builder {
return await Promise.all([relPath, fs.stat(file), fs.readFile(file)]);
}),
);
await fileInfos.map(async (fileInfo: [string, fs.Stats, Buffer]) => {
await new Promise<void>((resolve, reject) =>
pack.entry(
{ name: fileInfo[0], size: fileInfo[1].size },
fileInfo[2],
(err) => {
if (err) {
reject(err);
} else {
resolve();
}
},
),
);
});
await Promise.all(
fileInfos.map(async (fileInfo) => {
await new Promise<void>((resolve, reject) =>
pack.entry(
{ name: fileInfo[0], size: fileInfo[1].size },
fileInfo[2],
(err) => {
if (err) {
reject(err);
} else {
resolve();
}
},
),
);
}),
);
// Tell the tar stream we're done
pack.finalize();
// Create a build stream to send the data to
Expand Down

0 comments on commit 76a9cec

Please sign in to comment.