Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ interface DeviceTokenError {
}

function openUrl(url: string): void {
const cmd = platform() === 'darwin' ? 'open' : 'xdg-open'
exec(`${cmd} ${JSON.stringify(url)}`, () => {
const plt = platform()
let cmd: string
if (plt === 'darwin') {
cmd = `open ${JSON.stringify(url)}`
} else if (plt === 'win32') {
// On Windows, `start` is a shell built-in — must invoke via cmd /c
cmd = `cmd /c start "" ${JSON.stringify(url)}`
} else {
cmd = `xdg-open ${JSON.stringify(url)}`
}
exec(cmd, () => {
// Ignore errors (e.g., no browser available)
})
}
Expand Down