Skip to content

Commit

Permalink
Fix open in browser doesn't work in WSL
Browse files Browse the repository at this point in the history
On Linux, `x-default-browser` requires `xdg-utils` to be installed to
determine a default browser. So it fails when it's not installed.
However, in WSL, we still can open a browser without it. Now it
fallbacks to `open` when `x-default-browser` fails which makes it work on WSL
without `xdg-utils`.
  • Loading branch information
lesha1201 committed May 23, 2022
1 parent efba3ae commit eab88cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core-server/src/utils/open-in-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import dedent from 'ts-dedent';
export function openInBrowser(address: string) {
getDefaultBrowser(async (err: any, res: any) => {
try {
if (res.isChrome || res.isChromium) {
if (res && (res.isChrome || res.isChromium)) {
// We use betterOpn for Chrome because it is better at handling which chrome tab
// or window the preview loads in.
betterOpn(address);
Expand Down

0 comments on commit eab88cc

Please sign in to comment.