fix: Squirrel.Mac crash when zip extraction fails #47271
+81
−0
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.
Description of Change
Fixes #47270
Squirrel.Mac launches
/usr/bin/ditto
to extract the update zip file. When that process fails to launch, the (deprecated)launch
function will raise anNSInvalidArgumentException
. This exception wasn't caught. Thus, the app crashed.This PR migrates the code to the (non-deprecated)
launchAndReturnError
function and adds proper error handling.I've also included a test to prevent this from regressing.
This is the first Objective-C code I've ever written, so please be extra careful during your review.
I've tested the change as follows:
All autoUpdater tests pass (incl. the newly added test).
The newly added test crashes with SIGTRAP on main.
CC @MarshallOfSound
Checklist
npm test
passesRelease Notes
Notes: Fixed crash in
autoUpdater
on macOS when zip extraction failed.