From 6c52bbc4c84b289613db3751be9b2ae3d5d9457b Mon Sep 17 00:00:00 2001 From: Dominik Schulz Date: Sat, 18 Dec 2021 21:52:35 +0100 Subject: [PATCH] Prefer pinentry-mac on Darwin gpgconf isn't very reliable or useful. --- pinentry_darwin.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 }