Skip to content

Commit fcebdc9

Browse files
authored
nss: use certutil from $PATH if found on macOS (#71)
Fixes #70 Thanks to @hostep for testing and fixing the patch.
1 parent 5f8e78d commit fcebdc9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

truststore_nss.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ func init() {
2828

2929
switch runtime.GOOS {
3030
case "darwin":
31-
out, err := exec.Command("brew", "--prefix", "nss").Output()
31+
var err error
32+
certutilPath, err = exec.LookPath("certutil")
3233
if err != nil {
33-
return
34+
var out []byte
35+
out, err = exec.Command("brew", "--prefix", "nss").Output()
36+
if err != nil {
37+
return
38+
}
39+
certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil")
40+
_, err = os.Stat(certutilPath)
3441
}
35-
certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil")
36-
37-
_, err = os.Stat(certutilPath)
3842
hasCertutil = err == nil
3943

4044
case "linux":

0 commit comments

Comments
 (0)