Skip to content

Commit 68aa3c8

Browse files
authored
fix(core): fix docusaurus start error for macOS users with no Chromium-based browser (#11205)
1 parent 76518fd commit 68aa3c8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/docusaurus/src/commands/utils/openBrowser/openBrowser.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,14 @@ async function tryOpenWithAppleScript({
7070
const command = `ps cax -o command | grep -E "^(${supportedChromiumBrowsers.join(
7171
'|',
7272
)})$"`;
73-
const result = await execPromise(command);
73+
74+
const result = await execPromise(command).catch(() => {
75+
// Ignore grep errors when macOS user has no Chromium-based browser
76+
// See https://github.com/facebook/docusaurus/issues/11204
77+
});
78+
if (!result) {
79+
return [];
80+
}
7481

7582
const activeBrowsers = result.stdout.toString().trim().split('\n');
7683

0 commit comments

Comments
 (0)