From 98f9fdb7cc949469d34a1428c3dd093ebf6aa4eb Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sun, 29 Sep 2024 15:27:29 +0900 Subject: [PATCH] dbus: configurable xdg-dbus-proxy output Signed-off-by: Ophestra Umiker --- dbus/run.go | 10 +++++----- internal/app/share.dbus.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dbus/run.go b/dbus/run.go index eef0d14..0b8267f 100644 --- a/dbus/run.go +++ b/dbus/run.go @@ -2,14 +2,14 @@ package dbus import ( "errors" - "os" + "io" "git.ophivana.moe/cat/fortify/helper" ) // Start launches the D-Bus proxy and sets up the Wait method. // ready should be buffered and should only be received from once. -func (p *Proxy) Start(ready chan error, output bool) error { +func (p *Proxy) Start(ready chan error, output io.Writer) error { p.lock.Lock() defer p.lock.Unlock() @@ -25,9 +25,9 @@ func (p *Proxy) Start(ready chan error, output bool) error { // xdg-dbus-proxy does not need to inherit the environment h.Env = []string{} - if output { - h.Stdout = os.Stdout - h.Stderr = os.Stderr + if output != nil { + h.Stdout = output + h.Stderr = output } if err := h.StartNotify(ready); err != nil { return err diff --git a/internal/app/share.dbus.go b/internal/app/share.dbus.go index e94d648..b1be631 100644 --- a/internal/app/share.dbus.go +++ b/internal/app/share.dbus.go @@ -102,7 +102,7 @@ func (tx *appSealTx) startDBus() error { tx.dbusWait = make(chan struct{}) // background dbus proxy start - if err := tx.dbus.Start(ready, true); err != nil { + if err := tx.dbus.Start(ready, os.Stderr); err != nil { return (*StartDBusError)(wrapError(err, "cannot start message bus proxy:", err)) } verbose.Println("starting message bus proxy:", tx.dbus)