nss: use certutil from $PATH if found on macOS (#71)

Fixes #70

Thanks to @hostep for testing and fixing the patch.
This commit is contained in:
Filippo Valsorda
2018-08-25 15:52:43 -06:00
committed by GitHub
parent 5f8e78d012
commit fcebdc9845

View File

@@ -28,13 +28,17 @@ func init() {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin":
out, err := exec.Command("brew", "--prefix", "nss").Output() var err error
certutilPath, err = exec.LookPath("certutil")
if err != nil { 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 hasCertutil = err == nil
case "linux": case "linux":