Skip to content

Commit

Permalink
nss: use certutil from $PATH if found on macOS (#71)
Browse files Browse the repository at this point in the history
Fixes #70

Thanks to @hostep for testing and fixing the patch.
  • Loading branch information
FiloSottile committed Aug 25, 2018
1 parent 5f8e78d commit fcebdc9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions truststore_nss.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ func init() {

switch runtime.GOOS {
case "darwin":
out, err := exec.Command("brew", "--prefix", "nss").Output()
var err error
certutilPath, err = exec.LookPath("certutil")
if err != nil {
return
var out []byte
out, err = exec.Command("brew", "--prefix", "nss").Output()
if err != nil {
return
}
certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil")
_, err = os.Stat(certutilPath)
}
certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil")

_, err = os.Stat(certutilPath)
hasCertutil = err == nil

case "linux":
Expand Down

0 comments on commit fcebdc9

Please sign in to comment.