zenity/internal/zen/zen_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() {
for _, tool = range [3]string{"matedialog", "qarma", "zenity"} {
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()
}