diff --git a/src/js/internal/debugger.ts b/src/js/internal/debugger.ts index 4dfaf34ed9..66964eb4e2 100644 --- a/src/js/internal/debugger.ts +++ b/src/js/internal/debugger.ts @@ -128,7 +128,7 @@ export default function ( if (protocol.includes("ws")) { const debugUrl = `https://debug.bun.sh/#${host}${pathname}`; Bun.write(Bun.stderr, `Inspect in browser:\n ${link(debugUrl)}\n`); - + // Open browser if requested if (openInBrowser) { openUrlInBrowser(debugUrl); @@ -647,12 +647,9 @@ function openUrlInBrowser(url: string): void { // Use Bun.spawn in a detached way to open the browser without blocking // Similar to how bun create does it using openURL try { - const opener = process.platform === "darwin" - ? "/usr/bin/open" - : process.platform === "win32" - ? "start" - : "xdg-open"; - + const opener = + process.platform === "darwin" ? "/usr/bin/open" : process.platform === "win32" ? "start" : "xdg-open"; + // Spawn without awaiting to avoid blocking Bun.spawn([opener, url], { stdio: ["ignore", "ignore", "ignore"], diff --git a/test/cli/inspect-browser.test.ts b/test/cli/inspect-browser.test.ts index b502a69444..9d02651eee 100644 --- a/test/cli/inspect-browser.test.ts +++ b/test/cli/inspect-browser.test.ts @@ -1,4 +1,4 @@ -import { test, expect } from "bun:test"; +import { expect, test } from "bun:test"; import { bunEnv, bunExe, tempDirWithFiles } from "harness"; // Tests for the --inspect-browser flag functionality @@ -167,4 +167,4 @@ test.skipIf(!isLinux)("--inspect-browser should work with script that has spaces expect(stderr).toContain("Bun Inspector"); expect(stderr).toContain("Inspect in browser:"); expect(stderr).toContain("https://debug.bun.sh"); -}); \ No newline at end of file +});