Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 8df688f

Browse files
committed
fix: support cross-platform url open
1 parent 68bcca6 commit 8df688f

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

src/commands/login.command.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,27 @@ const nanoid = customAlphabet("123456789QAZWSXEDCRFVTGBYHNUJMIKOLP", 8)
4242

4343
const generateNanoid = Effect.sync(() => nanoid())
4444

45-
const openUrl = (urlToOpen: string) =>
46-
Effect.try({
47-
try: () => ChildProcess.spawn("open", [urlToOpen]),
45+
const openUrl = (urlToOpen: string) => {
46+
const openCommand =
47+
process.platform === "darwin"
48+
? "open"
49+
: process.platform === "win32"
50+
? "start"
51+
: "xdg-open"
52+
53+
return Effect.try({
54+
try: () =>
55+
ChildProcess.spawn(openCommand, [urlToOpen], {
56+
shell: process.platform === "win32",
57+
}),
4858
catch: (cause) =>
4959
new ProcessError({
5060
message: `Failed to open URL: ${urlToOpen}`,
51-
command: "open",
61+
command: openCommand,
5262
cause,
5363
}),
5464
})
65+
}
5566

5667
const getUserConfigPath = Effect.sync(() => Path.join(OS.homedir(), FILENAME))
5768

0 commit comments

Comments
 (0)