Files
ProxyPilot/internal/tui/browser.go
2026-02-15 14:52:40 +08:00

23 lines
424 B
Go

package tui
import (
"os/exec"
"runtime"
)
// openBrowser opens the specified URL in the default browser.
func openBrowser(url string) error {
var cmd *exec.Cmd
switch runtime.GOOS {
case "windows":
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
case "darwin":
cmd = exec.Command("open", url)
default: // linux, freebsd, etc.
cmd = exec.Command("xdg-open", url)
}
return cmd.Start()
}