summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrvi <crvisqr@gmail.com>2020-08-14 02:52:59 +0530
committercrvi <crvisqr@gmail.com>2020-08-14 03:44:02 +0530
commitec864ad39bc7a4ed46d2396871f89363dc209c5f (patch)
treeff739020a89225c9f5c76177b8a4f9f3597c53ac
parent550031310c4c6ef34e78fe029e2b239d44095d4f (diff)
downloadzeitgeist-ec864ad39bc7a4ed46d2396871f89363dc209c5f.tar.gz
test: fix incorrect process reporting
reports the grep process rather than that of zeitgeist-daemon
-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):