fix: be lenient in parsing notarytool output
We were seeing failures in our CI on notarytool invocations, as warnings emitted by notarytool were tried to be parsed as JSON. An example for such a warning is the following:
✖ Finalizing package [FAILED: Failed to notarize via notarytool. Failed with unexpected result:
warning: unhandled Platform key FamilyDisplayName
{"id":"4803438f-a484-493a-acfd-1ef504a1e70b","message":"Processing complete","status":"Accepted"}]
This makes it so the parsing can work with such warnings, by finding the valid JSON line in the output and only using that to parse from.
The less-hacky way to fix this would be to properly
differentiate between stdout and stderr in spawn.ts,
but I'm unable to test other commands and didn't
want to break stuff, so I address the issue for
notarytool only here.
Furthermore, this makes the assumption that Apple's signing servers will only reply with a single JSON line. This was the case for all my testing queries, but I'm not sure if this holds true universally.
Still, I think this is much better than the current situation, which just fails on whatever warning is emitted by notarytool.
Fixed the 2 CI failures, feel free to re-run @BlackHole1
Hmm:
[11:13] msanft:notarize @ msanft/notarytool-json-fix-build is 📦 semantic
❯ npm run lint
> @electron/[email protected] lint
> prettier --check "src/**/*.ts"
Checking formatting...
All matched files use Prettier code style!
[11:14] msanft:notarize @ msanft/notarytool-json-fix-build is 📦 semantic
✦ ❯ git push --force-with-lease
Everything up-to-date