Fix shell.openExternal
calls now that it's an async method
#8156
Labels
electron
Issues related to our use of Electron that may need updates to Electron or upstream fixes
Projects
With the upgrade to Electron 5
shell.openExternal
is now an async method (see electron/electron#16176).So we want to update the following accordingly...
desktop/app/src/main-process/main.ts
Lines 483 to 484 in e23328a
As it is now, we prematurely send the 'open-external-result' event. And we won't be alerted if this operation fails, as we're not handling the promise rejection. From what I can tell we're not actually doing anything with
result
, so nothing is breaking due to the fact that its value is now a promise rather than a boolean, as was previously returned fromshell.openExternal
.To fix this we can either use
shell.openExternalSync
or await the promise that is now returned fromshell.openExternal
.Note that strangely
shell.openExternalSync
returns aboolean
whereasshell.openExternal
returnsPromise<void>
. I'm generally in favor of using the async method, unless we rely on theboolean
return value for subsequent logic in our code.There are several other places that we use
shell.openExternal
in the code, so we'll want to do a thorough audit and make sure to use the appropriate method in each case./cc @vilmibm
The text was updated successfully, but these errors were encountered: