Redo mpd.pid handling. Fixes #9

pull/11/head
Stein Ivar Berghei 2023-03-30 18:38:53 +02:00
parent 33230a54d5
commit 1f07fc01de
1 changed files with 2 additions and 5 deletions

7
mpd.go
View File

@ -42,10 +42,7 @@ func init() {
f.Close()
pidstr, err := os.ReadFile(config.GetString("mpd.pid"))
switch err {
case os.ErrNotExist:
log.Println("Pidfile not found, doing nothing")
case nil:
if err != nil && os.IsNotExist(err) {
pid, _ := strconv.Atoi(string(bytes.TrimSpace(pidstr)))
proc, err := os.FindProcess(pid)
switch err {
@ -56,7 +53,7 @@ func init() {
default:
log.Fatal(err)
}
default:
} else if err != nil {
log.Fatal(err)
}