Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use openExternal async #8220

Merged
merged 4 commits into from Sep 10, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions app/src/main-process/main.ts
Expand Up @@ -471,7 +471,7 @@ app.on('ready', () => {

ipcMain.on(
'open-external',
(event: Electron.IpcMessageEvent, { path }: { path: string }) => {
async (event: Electron.IpcMessageEvent, { path }: { path: string }) => {
const pathLowerCase = path.toLowerCase()
if (
pathLowerCase.startsWith('http://') ||
Expand All @@ -480,7 +480,14 @@ app.on('ready', () => {
log.info(`opening in browser: ${path}`)
}

const result = shell.openExternal(path)
let result
try {
await shell.openExternal(path)
result = true
} catch (e) {
log.error(`Call to openExternal failed: '${e}'`)
result = false
}
event.sender.send('open-external-result', { result })
}
)
Expand Down