zenity/internal/zen/run_unix.go

31 lines
506 B
Go
Raw Normal View History

2020-01-09 06:17:39 -05:00
// +build !windows,!darwin
package zen
import (
"os"
"os/exec"
"syscall"
"github.com/ncruces/zenity/internal/cmd"
)
var tool, path string
func init() {
2020-01-09 21:14:50 -05:00
for _, tool = range [3]string{"qarma", "zenity", "matedialog"} {
2020-01-09 06:17:39 -05:00
path, _ = exec.LookPath(tool)
if path != "" {
return
}
}
tool = "zenity"
}
func Run(args []string) ([]byte, error) {
if cmd.Command && path != "" {
syscall.Exec(path, append([]string{tool}, args...), os.Environ())
}
return exec.Command(tool, args...).Output()
}