diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-09-25 01:17:38 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-09-25 01:17:38 +0900 |
| commit | a8b4b3634b8bef6040601d970a7c178da72b114d (patch) | |
| tree | 4bd8a012f67dcf854fc6593caec6504262d0f436 /internal | |
| parent | 97bab6c4061e15c64170d3dca29eadce9841a9d5 (diff) | |
dbus: use generalised helper.Helper for xdg-dbus-proxy
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/app/share.dbus.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/app/share.dbus.go b/internal/app/share.dbus.go index 43f196e2..29025029 100644 --- a/internal/app/share.dbus.go +++ b/internal/app/share.dbus.go @@ -23,7 +23,6 @@ const ( var ( ErrDBusConfig = errors.New("dbus config not supplied") ErrDBusProxy = errors.New(xdgDBusProxy + " not found") - ErrDBusFault = errors.New(xdgDBusProxy + " did not start correctly") ) type ( @@ -98,12 +97,12 @@ func (seal *appSeal) shareDBus(config [2]*dbus.Config) error { func (tx *appSealTx) startDBus() error { // ready channel passed to dbus package - ready := make(chan bool, 1) + ready := make(chan error, 1) // used by waiting goroutine to notify process return tx.dbusWait = make(chan struct{}) // background dbus proxy start - if err := tx.dbus.Start(&ready); err != nil { + if err := tx.dbus.Start(ready); err != nil { return (*StartDBusError)(wrapError(err, "cannot start message bus proxy:", err)) } verbose.Println("starting message bus proxy:", tx.dbus) @@ -130,9 +129,10 @@ func (tx *appSealTx) startDBus() error { tx.dbusWait <- struct{}{} }() - // ready is false if the proxy process faulted - if !<-ready { - return (*StartDBusError)(wrapError(ErrDBusFault, "message bus proxy failed")) + // ready is not nil if the proxy process faulted + if err := <-ready; err != nil { + // note that err here is either an I/O related error or a predetermined unexpected behaviour error + return (*StartDBusError)(wrapError(err, "message bus proxy fault after start:", err)) } verbose.Println("message bus proxy ready") |
