1 Star 0 Fork 0

alexzshl / az-go-utils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
exec.go 478 Bytes
一键复制 编辑 原始数据 按行查看 历史
alexzshl 提交于 2021-09-30 01:10 . update
package executil
import (
"fmt"
"os/exec"
"runtime"
)
var commands = map[string]string{
"windows": "explorer",
"darwin": "open",
"linux": "xdg-open",
}
// OpenURI Open calls the OS default program for uri
func OpenURI(uri string) error {
command, ok := commands[runtime.GOOS]
if !ok {
return fmt.Errorf("don't know how to open things on %s platform", runtime.GOOS)
}
cmd := exec.Command(command, uri)
defer fmt.Printf("open %s ", uri)
return cmd.Start()
}
1
https://gitee.com/alexzshl/az-go-utils.git
git@gitee.com:alexzshl/az-go-utils.git
alexzshl
az-go-utils
az-go-utils
v1.3.0

搜索帮助

53164aa7 5694891 3bd8fe86 5694891