| 382 | } |
| 383 | |
| 384 | function tryOpen(pathOrUrl: string): void { |
| 385 | const platform = process.platform; |
| 386 | const cmd = platform === "darwin" ? "open" : |
| 387 | platform === "win32" ? "cmd" : |
| 388 | "xdg-open"; |
| 389 | const args = platform === "win32" ? ["/c", "start", "", pathOrUrl] : [pathOrUrl]; |
| 390 | try { |
| 391 | const child = spawn(cmd, args, { detached: true, stdio: "ignore" }); |
| 392 | child.unref(); |
| 393 | } catch { |
| 394 | // Non-fatal; the caller already has the path and will print it. |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | /** Setup-only re-export so cli.ts can dynamic-import without another file. */ |
| 399 | export { ExitCode }; |