MCPcopy
hub / github.com/SurgeDM/Surge / openWithSystem

Function openWithSystem

internal/tui/commands.go:29–46  ·  view source on GitHub ↗

openWithSystem opens a file or URL with the system's default application

(path string)

Source from the content-addressed store, hash-verified

27
28// openWithSystem opens a file or URL with the system's default application
29func openWithSystem(path string) error {
30 var cmd *exec.Cmd
31 switch runtime.GOOS {
32 case "darwin":
33 cmd = exec.Command("open", path)
34 case "windows":
35 cmd = exec.Command("cmd", "/c", "start", "", path)
36 default: // linux and others
37 cmd = exec.Command("xdg-open", path)
38 }
39 err := cmd.Start()
40 if err == nil {
41 go func() {
42 _ = cmd.Wait()
43 }()
44 }
45 return err
46}

Callers 2

updateUpdateAvailableMethod · 0.70
updateDashboardMethod · 0.70

Calls 1

StartMethod · 0.80

Tested by

no test coverage detected