diff options
Diffstat (limited to 'pkg/systemd/notifyproxy/notifyproxy.go')
-rw-r--r-- | pkg/systemd/notifyproxy/notifyproxy.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/systemd/notifyproxy/notifyproxy.go b/pkg/systemd/notifyproxy/notifyproxy.go index b9f5737f7..9e6eb4cf0 100644 --- a/pkg/systemd/notifyproxy/notifyproxy.go +++ b/pkg/systemd/notifyproxy/notifyproxy.go @@ -12,7 +12,15 @@ import ( ) // SendMessage sends the specified message to the specified socket. +// No message is sent if no socketPath is provided and the NOTIFY_SOCKET +// variable is not set either. func SendMessage(socketPath string, message string) error { + if socketPath == "" { + socketPath, _ = os.LookupEnv("NOTIFY_SOCKET") + if socketPath == "" { + return nil + } + } socketAddr := &net.UnixAddr{ Name: socketPath, Net: "unixgram", |