diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2013-07-25 14:17:06 +0200 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2013-07-25 14:17:06 +0200 |
commit | df52efa709248adddcddb320323af9b97b33b7fd (patch) | |
tree | a801d40f2e558a6d86636568718f1bc9579af7a0 | |
parent | 4f329e781cc82b3f88557c0c9e56e1563e34d108 (diff) |
util: add show_messages function to print dbus-monitor output
-rw-r--r-- | src/util.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util.py b/src/util.py index 36b6616..ae88084 100644 --- a/src/util.py +++ b/src/util.py @@ -44,6 +44,20 @@ def spawnbus(quiet = False): _process_input (process.stderr, "STDERR", quiet) return process +# TODO: it might be more useful to read the input stream synchronously +# for this +def show_messages(quiet): + command = ['dbus-monitor', '--session'] + + process = subprocess.Popen(command, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + ) + atexit.register(lambda p: os.kill(p.pid, signal.SIGKILL), process) + + _process_input(process.stdout, "MONITOR", quiet) + _process_input(process.stderr, "MONITOR", quiet) + def override_env (variable, var, quiet = False): os.environ[variable] = var if not quiet: |