MCPcopy Create free account
hub / github.com/dan-v/lambda-nat-proxy / openBrowser

Function openBrowser

cmd/lambda-nat-proxy/cmd_run.go:287–309  ·  view source on GitHub ↗

openBrowser opens the specified URL in the user's default browser

(url string)

Source from the content-addressed store, hash-verified

285
286// openBrowser opens the specified URL in the user's default browser
287func openBrowser(url string) {
288 var cmd string
289 var args []string
290
291 switch runtime.GOOS {
292 case "windows":
293 cmd = "cmd"
294 args = []string{"/c", "start"}
295 case "darwin":
296 cmd = "open"
297 default: // "linux", "freebsd", "openbsd", "netbsd"
298 cmd = "xdg-open"
299 }
300
301 args = append(args, url)
302
303 if err := exec.Command(cmd, args...).Start(); err != nil {
304 log.Printf("🌐 Unable to auto-open browser: %v", err)
305 log.Printf("🌐 Please manually open: %s", url)
306 } else {
307 log.Printf("🚀 Dashboard opening in your browser...")
308 }
309}

Callers 1

runProxyFunction · 0.85

Calls 1

StartMethod · 0.65

Tested by

no test coverage detected