Skip to content

Commit 5133613

Browse files
committed
fix(cli): add spawn error listener to prevent ENOENT crash
1 parent 1e1d7b9 commit 5133613

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

packages/cli/src/utils/openBrowser.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from "bun:test";
1+
import { describe, it, expect } from "vitest";
22
import { buildBrowserArgs } from "./openBrowser.js";
33

44
describe("buildBrowserArgs", () => {

packages/cli/src/utils/openBrowser.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ export function buildBrowserArgs(url: string, options: OpenBrowserOptions): stri
2929
export function openBrowser(url: string, options: OpenBrowserOptions = {}): void {
3030
if (options.browserPath) {
3131
const args = buildBrowserArgs(url, options);
32-
spawn(options.browserPath, args, { detached: true, stdio: "ignore" }).unref();
32+
const child = spawn(options.browserPath, args, {
33+
detached: true,
34+
stdio: "ignore",
35+
});
36+
child.on("error", () => {});
37+
child.unref();
3338
return;
3439
}
3540

0 commit comments

Comments
 (0)