mirror of
https://github.com/fumiama/terasu-cloudflared.git
synced 2026-06-06 17:40:24 +08:00
AUTH-2077: Quotes open browser command in windows
This commit is contained in:
18
cmd/cloudflared/shell/launch_browser_windows.go
Normal file
18
cmd/cloudflared/shell/launch_browser_windows.go
Normal file
@@ -0,0 +1,18 @@
|
||||
//+build windows
|
||||
|
||||
package shell
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user