Handle launcher opener failures and add no-open mode
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
1 parent
e58c71a30e
commit
9e804c3c85
3 files changed
+19
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user