system/dbus: dump method prints msgbuf
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
568d7758d5
commit
2e52191404
@ -34,8 +34,8 @@ var posixUsername = regexp.MustCompilePOSIX("^[a-z_]([A-Za-z0-9_-]{0,31}|[A-Za-z
|
|||||||
type appSeal struct {
|
type appSeal struct {
|
||||||
// app unique ID string representation
|
// app unique ID string representation
|
||||||
id string
|
id string
|
||||||
// dbus proxy message buffer retriever
|
// dump dbus proxy message buffer
|
||||||
dbusMsg func(f func(msgbuf []string))
|
dbusMsg func()
|
||||||
|
|
||||||
// freedesktop application ID
|
// freedesktop application ID
|
||||||
fid string
|
fid string
|
||||||
|
@ -140,11 +140,7 @@ func (a *app) Run(ctx context.Context, rs *RunState) error {
|
|||||||
|
|
||||||
// print queued up dbus messages
|
// print queued up dbus messages
|
||||||
if a.seal.dbusMsg != nil {
|
if a.seal.dbusMsg != nil {
|
||||||
a.seal.dbusMsg(func(msgbuf []string) {
|
a.seal.dbusMsg()
|
||||||
for _, msg := range msgbuf {
|
|
||||||
fmsg.Println(msg)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update store and revert app setup transaction
|
// update store and revert app setup transaction
|
||||||
|
@ -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)
|
d := new(DBus)
|
||||||
|
|
||||||
// used by waiting goroutine to notify process exit
|
// 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
|
// seal dbus proxy
|
||||||
d.out = &scanToFmsg{msg: new(strings.Builder)}
|
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:")
|
"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()
|
s.mu.RLock()
|
||||||
f(s.msgbuf)
|
for _, msg := range s.msgbuf {
|
||||||
|
fmsg.Println(msg)
|
||||||
|
}
|
||||||
s.mu.RUnlock()
|
s.mu.RUnlock()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user