diff --git a/pinentry_darwin.go b/pinentry_darwin.go index f634a1e..40c0c86 100644 --- a/pinentry_darwin.go +++ b/pinentry_darwin.go @@ -1,11 +1,20 @@ +//go:build darwin // +build darwin package pinentry -import "github.com/gopasspw/pinentry/gpgconf" +import ( + "os/exec" + + "github.com/gopasspw/pinentry/gpgconf" +) // GetBinary always returns pinentry-mac func GetBinary() string { + // check, whether the returned path acutally exists + if _, err := exec.LookPath("pinentry-mac"); err == nil { + return "pinentry-mac" + } if p, err := gpgconf.Path("pinentry"); err == nil && p != "" { return p } diff --git a/pinentry_others.go b/pinentry_others.go index 4a60e38..a0380f8 100644 --- a/pinentry_others.go +++ b/pinentry_others.go @@ -2,12 +2,18 @@ package pinentry -import "github.com/gopasspw/pinentry/gpgconf" +import ( + "github.com/gopasspw/pinentry/gpgconf" + "os/exec" +) // GetBinary returns the binary name func GetBinary() string { if p, err := gpgconf.Path("pinentry"); err == nil && p != "" { - return p + // check, whether the returned path acutally exists + if _, err := exec.LookPath(p); err == nil { + return p + } } return "pinentry" }