fix(package): ensure electron-packager
throws if fails
#3136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summarize your changes:
Fixes #3128
For context, we use some pretty ugly hacks for Electron Packager to work with Listr2 (without being written with Listr2 itself).
To make this work, there's a single
packagerPromise
resolving from theelectron-packager
call:forge/packages/api/core/src/api/package.ts
Lines 307 to 313 in 6a118c6
If this Promise rejects, then we catch it and reject it with an array of reject handlers from all subtasks declared above:
forge/packages/api/core/src/api/package.ts
Line 177 in 6a118c6
The problem here is that the
rejects
array is empty in the first.catch()
, so the error is caught but never propagated. Therefore, the CLI ends up stalling indefinitely.To solve this problem, we add the Promise reject handler from
targetsPromise
to therejects
array so thepackagerPromise
catch clause has a validrejects
target.