2021-11-09 11:37:51 +00:00
|
|
|
//go:build windows
|
|
|
|
// +build windows
|
2019-09-23 20:19:54 +00:00
|
|
|
|
2021-03-08 16:46:23 +00:00
|
|
|
package token
|
2019-09-23 20:19:54 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os/exec"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
func getBrowserCmd(url string) *exec.Cmd {
|
|
|
|
cmd := exec.Command("cmd")
|
|
|
|
// CmdLine is only defined when compiling for windows.
|
|
|
|
// Empty string is the cmd proc "Title". Needs to be included because the start command will interpret the first
|
|
|
|
// quoted string as that field and we want to quote the URL.
|
|
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{CmdLine: fmt.Sprintf(`/c start "" "%s"`, url)}
|
|
|
|
return cmd
|
|
|
|
}
|