Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

Commit

Permalink
Merge branch 'main' of github.com:gopasspw/pinentry
Browse files Browse the repository at this point in the history
* 'main' of github.com:gopasspw/pinentry:
  Prefer pinentry-mac on Darwin
  Revert "change module github url"
  change module github url
  partly fixes #1. Check path of pinentry.
  • Loading branch information
dominikschulz committed Jan 10, 2022
2 parents f7bb423 + 6c52bbc commit 9a3d859
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
11 changes: 10 additions & 1 deletion pinentry_darwin.go
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down
10 changes: 8 additions & 2 deletions pinentry_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 9a3d859

Please sign in to comment.