From 9e804c3c85123dfec6f8646aad4c553121bbc430 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 9 Feb 2026 22:14:37 +0000 Subject: [PATCH] Handle launcher opener failures and add no-open mode Co-authored-by: Theo Browne --- README.md | 6 ++++++ apps/t3/src/cli.ts | 7 +++++++ apps/t3/src/runtimeApiServer.ts | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/README.md b/README.md index df2c0e171f..11cac01c83 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ On launch, `t3`: 2. serves the web UI in your browser, 3. auto-connects to your current working directory as the default project. +Optional environment variables: + +- `T3_NO_OPEN=1` — start runtime without auto-opening a browser window. +- `T3_BACKEND_PORT` — override local WebSocket runtime port (default `4317`). +- `T3_WEB_PORT` — override local web UI port (default `4318`). + ## Workspace layout - `/apps/t3`: CLI launcher + local WebSocket runtime server. diff --git a/apps/t3/src/cli.ts b/apps/t3/src/cli.ts index 721a40e1fd..c9f702ed52 100644 --- a/apps/t3/src/cli.ts +++ b/apps/t3/src/cli.ts @@ -21,6 +21,10 @@ function parsePort(value: string | undefined, fallback: number): number { } function openBrowser(url: string): void { + if (process.env.T3_NO_OPEN === "1") { + return; + } + const command = process.platform === "win32" ? "cmd" : process.platform === "darwin" ? "open" : "xdg-open"; const args = process.platform === "win32" ? ["/c", "start", "", url] : [url]; @@ -29,6 +33,9 @@ function openBrowser(url: string): void { detached: true, stdio: "ignore", }); + child.on("error", () => { + // Best-effort browser launch; keep runtime alive even when opener is unavailable. + }); child.unref(); } diff --git a/apps/t3/src/runtimeApiServer.ts b/apps/t3/src/runtimeApiServer.ts index 2384428449..8b84be4cb9 100644 --- a/apps/t3/src/runtimeApiServer.ts +++ b/apps/t3/src/runtimeApiServer.ts @@ -119,6 +119,9 @@ function openPathInFileManager(targetPath: string): void { detached: true, stdio: "ignore", }); + child.on("error", () => { + // Best-effort shell handoff. + }); child.unref(); } @@ -405,6 +408,9 @@ export async function startRuntimeApiServer( detached: true, stdio: "ignore", }); + child.on("error", () => { + // Best-effort editor launch. + }); child.unref(); return null; }