Skip to content

Commit

Permalink
notification systemd: handle the Stat API better
Browse files Browse the repository at this point in the history
  • Loading branch information
jwijenbergh committed Jun 25, 2024
1 parent 228a32a commit eed6020
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/notification/systemd/systemd.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package systemd

import (
"errors"
"fmt"
"os"
"os/exec"
Expand All @@ -9,9 +10,13 @@ import (
)

func hasSystemd() bool {
if _, err := os.Stat("/run/systemd/system"); !os.IsNotExist(err) {
var err error
if _, err = os.Stat("/run/systemd/system"); err == nil {
return true
} else if errors.Is(err, os.ErrNotExist) {
return false
}
slog.Error("failed to determine if system has systemd support", "error", err)
return false
}

Expand Down

0 comments on commit eed6020

Please sign in to comment.