Skip to content

Commit

Permalink
[adb] Simplify ps called used in process_exists()
Browse files Browse the repository at this point in the history
  • Loading branch information
tysmith committed Sep 13, 2022
1 parent 2a15ca8 commit 3c29ed9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion grizzly/target/adb_device/adb_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,9 @@ def process_exists(self, pid):
Returns:
bool: True if the process exists otherwise False
"""
return any(self._get_procs(pid=pid))
# this is called frequently and should be as light weight as possible
pid = str(pid)
return pid in self.shell(["ps", "-p", pid, "-o", "pid"], timeout=30)[1]

def pull(self, src, dst):
"""Copy file from connected device.
Expand Down

0 comments on commit 3c29ed9

Please sign in to comment.