Ensure PID directory tree exists
parent
5b5dd896bd
commit
2aa9b6ea33
|
@ -126,6 +126,12 @@ func writePIDFile(path string) {
|
|||
return
|
||||
}
|
||||
|
||||
// Ensure the required directory structure exists.
|
||||
err := os.MkdirAll(filepath.Dir(path), 0700)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Retrieve the PID and write it.
|
||||
pid := strconv.Itoa(os.Getpid())
|
||||
if err := ioutil.WriteFile(path, []byte(pid), 0644); err != nil {
|
||||
|
|
Loading…
Reference in New Issue