app/dbus: manage dbus proxy and pass address to child
This commit adds code that starts and registers the D-Bus proxy, as well as cleanup code that tracks and closes the daemon once our child exits. A few more flags were added to pass D-Bus config to xdg-dbus-proxy. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
@@ -65,4 +65,23 @@ func BeforeExit() {
|
||||
fmt.Printf("Stripped ACL entry for user '%s' from '%s'\n", u.Username, candidate)
|
||||
}
|
||||
}
|
||||
|
||||
if dbusProxy != nil {
|
||||
if system.V.Verbose {
|
||||
fmt.Println("D-Bus proxy registered, cleaning up")
|
||||
}
|
||||
|
||||
if err := dbusProxy.Close(); err != nil {
|
||||
if errors.Is(err, os.ErrClosed) {
|
||||
if system.V.Verbose {
|
||||
fmt.Println("D-Bus proxy already closed")
|
||||
}
|
||||
} else {
|
||||
fmt.Println("Error closing D-Bus proxy:", err)
|
||||
}
|
||||
}
|
||||
|
||||
// wait for Proxy.Wait to return
|
||||
<-*dbusDone
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user