Sample Header Ad - 728x90

How to adjust the output of dbus-monitor?

0 votes
1 answer
1243 views
I'm building a microservices application using the GNU tools and bash and I decided to use dbus-monitor and dbus-send for IPC between services. The problem is that it's hard to make use of the messages received by dbus-monitor since it splits metadata and payload in different lines. If I instantiate a listener with
dbus-monitor --system interface=org.foo.bar member=test \
 | while read a; do
  echo got message $a
done
and communicate to it with
dbus-send --system --type=signal / org.foo.bar.test string:"hello world"
The output comes as
got line signal time=1676042614.782238 path=; interface=org.foo.bar; member=test
got line string "hello world"
even though string "hello world" is the payload to the message, it was written in a different line. I tried messing with IFS but no success. I also tried to change parameters to dbus-monitor, but the parameter --profile omits the payload. So I dont know how to solve this.
Asked by CyberWizard (1 rep)
Feb 10, 2023, 03:37 PM
Last activity: Feb 12, 2023, 12:32 PM