summaryrefslogtreecommitdiff
path: root/test/dbus/testutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/dbus/testutils.py')
-rw-r--r--test/dbus/testutils.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/dbus/testutils.py b/test/dbus/testutils.py
index 84aee2d1..ad2fe25c 100644
--- a/test/dbus/testutils.py
+++ b/test/dbus/testutils.py
@@ -141,9 +141,14 @@ class RemoteTestCase (unittest.TestCase):
@staticmethod
def _get_pid(matching_string):
- p1 = Popen(["ps", "aux"], stdout=PIPE, stderr=PIPE)
- p2 = Popen(["grep", matching_string], stdin=p1.stdout, stderr=PIPE, stdout=PIPE)
- return p2.communicate()[0].decode()
+ p1 = Popen(["pgrep", "-x", "zeitgeist-daemo"], stdout=PIPE, stderr=PIPE)
+ out = p1.communicate()[0]
+ pid = out.decode().split('\n')[0]
+
+ p2 = Popen(["ps", "--no-headers", "-fp", pid], stderr=PIPE, stdout=PIPE)
+ pid_line = p2.communicate()[0].decode()
+
+ return pid_line
@staticmethod
def _safe_start_subprocess(cmd, env, timeout=1, error_callback=None):