From 2e521914042ec427cae3c429b448c4bc3eed61de Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 7 Feb 2025 13:16:54 +0900 Subject: system/dbus: dump method prints msgbuf Signed-off-by: Ophestra --- internal/system/dbus.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'internal/system') diff --git a/internal/system/dbus.go b/internal/system/dbus.go index 886ba77f..859fa029 100644 --- a/internal/system/dbus.go +++ b/internal/system/dbus.go @@ -23,7 +23,7 @@ func (sys *I) MustProxyDBus(sessionPath string, session *dbus.Config, systemPath } } -func (sys *I) ProxyDBus(session, system *dbus.Config, sessionPath, systemPath string) (func(f func(msgbuf []string)), error) { +func (sys *I) ProxyDBus(session, system *dbus.Config, sessionPath, systemPath string) (func(), error) { d := new(DBus) // used by waiting goroutine to notify process exit @@ -65,7 +65,7 @@ func (sys *I) ProxyDBus(session, system *dbus.Config, sessionPath, systemPath st // seal dbus proxy d.out = &scanToFmsg{msg: new(strings.Builder)} - return d.out.F, fmsg.WrapErrorSuffix(d.proxy.Seal(session, system), + return d.out.Dump, fmsg.WrapErrorSuffix(d.proxy.Seal(session, system), "cannot seal message bus proxy:") } @@ -195,8 +195,10 @@ func (s *scanToFmsg) write(p []byte, a int) (int, error) { } } -func (s *scanToFmsg) F(f func(msgbuf []string)) { +func (s *scanToFmsg) Dump() { s.mu.RLock() - f(s.msgbuf) + for _, msg := range s.msgbuf { + fmsg.Println(msg) + } s.mu.RUnlock() } -- cgit v1.3.1