bugfix: syscall.Kill is not available on windows

This commit is contained in:
2020-02-22 13:00:13 +01:00
parent 62fa89f857
commit 6afb1e7a69
+8 -2
View File
@@ -96,9 +96,15 @@ func renew(cert *certificate.Resource, cfg *Config) error {
log.Println("[INFO] triggering reload via SIGHUP")
// trigger reload by sending our process a SIGHUP
err = syscall.Kill(os.Getpid(), syscall.SIGHUP)
p, err := os.FindProcess(os.Getpid())
if err != nil {
return fmt.Errorf("simplecert: failed to trigger reload of renewed certificate: %s", err)
return fmt.Errorf("simplecert: failed to get process by PID: %s", err)
}
// send signal
err = p.Signal(syscall.SIGHUP)
if err != nil {
return fmt.Errorf("simplecert: failed to send SIGHUP to our process: %s", err)
}
}
}