From 3bbfd4f7c207eb7dc903b843a53589d2fc3dea87 Mon Sep 17 00:00:00 2001 From: Greg Brimble Date: Fri, 7 Jan 2022 14:29:08 +0000 Subject: [PATCH] Silently fail to auto-open the browser in `wrangler pages dev` command when that errors out (#211) --- .changeset/metal-ties-invent.md | 5 +++++ packages/wrangler/src/pages.tsx | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/metal-ties-invent.md diff --git a/.changeset/metal-ties-invent.md b/.changeset/metal-ties-invent.md new file mode 100644 index 000000000000..c1391653ad91 --- /dev/null +++ b/.changeset/metal-ties-invent.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +Silently fail to auto-open the browser in `wrangler pages dev` command when that errors out. diff --git a/packages/wrangler/src/pages.tsx b/packages/wrangler/src/pages.tsx index 63b713d0a214..12ffb7783c30 100644 --- a/packages/wrangler/src/pages.tsx +++ b/packages/wrangler/src/pages.tsx @@ -905,7 +905,9 @@ export const pages: BuilderCallback = (yargs) => { console.log(`Serving at http://127.0.0.1:${port}/`); if (process.env.BROWSER !== "none") { - await open(`http://127.0.0.1:${port}/`); + try { + await open(`http://127.0.0.1:${port}/`); + } catch {} } EXIT_CALLBACKS.push(() => {