Skip to content

Commit

Permalink
Abort after default browser fails (fixes #141)
Browse files Browse the repository at this point in the history
  • Loading branch information
yandeu committed Dec 2, 2024
1 parent 016e2a7 commit a595c30
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/openBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ export class OpenBrowser {

if (!res) {
if (typeof browser === 'string') {
message.log(colors(`Could not open browser "${browser}". Trying the default browser next.`, 'yellow'))
await this.launchDefaultBrowser(target)
if (browser === 'default') {
message.log(colors(`Could not open the default browser. Will abort!`, 'red'))
return
} else {
message.log(colors(`Could not open browser "${browser}". Trying the default browser next.`, 'yellow'))
await this.launchDefaultBrowser(target)
}
} else if (Array.isArray(browser)) {
if (typeof browser[index + 1] === 'undefined') {
message.log(colors(`Could not open browser "${browser[index]}". Trying the default browser next.`, 'yellow'))
Expand Down

0 comments on commit a595c30

Please sign in to comment.