okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

Aly Raffauffix(cli): handle clipboard exits and reap subprocessesc2aa1bc

main
428 B22 linesraw
1package config
2
3import (
4	"os/exec"
5	"runtime"
6)
7
8// OpenBrowser opens a URL in the system's default browser.
9func OpenBrowser(url string) {
10	var cmd *exec.Cmd
11	switch runtime.GOOS {
12	case "darwin":
13		cmd = exec.Command("open", url)
14	case "windows":
15		cmd = exec.Command("cmd", "/c", "start", "", url)
16	default:
17		cmd = exec.Command("xdg-open", url)
18	}
19	if err := cmd.Start(); err == nil {
20		go func() { _ = cmd.Wait() }()
21	}
22}