notify: gracefully handle vanishing processes

This commit is contained in:
Michael Stapelberg 2018-07-14 16:36:36 +02:00
parent 9e0f83a7cf
commit 3afe757a34

View File

@ -40,6 +40,9 @@ func Process(name string, sig os.Signal) error {
}
b, err := ioutil.ReadFile(filepath.Join("/proc", fi.Name(), "cmdline"))
if err != nil {
if os.IsNotExist(err) {
continue // process vanished
}
return err
}
if !strings.HasPrefix(string(b), name) {