mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-04-28 20:06:36 +00:00
* Use `github.com/rs/zerolog` for logging * Use `github.com/rs/zerolog` for logging (continue) * Add `debug` flag * Remove `github.com/op/go-logging` dependency completely * Fix linter
29 lines
509 B
Go
29 lines
509 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
"runtime"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func OpenBrowser(url string) {
|
|
var err error
|
|
|
|
switch runtime.GOOS {
|
|
case "linux":
|
|
err = exec.Command("xdg-open", url).Start()
|
|
case "windows":
|
|
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
|
|
case "darwin":
|
|
err = exec.Command("open", url).Start()
|
|
default:
|
|
err = fmt.Errorf("unsupported platform")
|
|
}
|
|
|
|
if err != nil {
|
|
log.Error().Err(err).Msg("While trying to open a browser")
|
|
}
|
|
}
|