Skip to content

Commit

Permalink
[adb] Only pass -A to ps when pid or --ppid is not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
tysmith committed Sep 13, 2022
1 parent ac0cf13 commit 6f00ccb
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 @@ -179,13 +179,15 @@ def _get_procs(self, pid=None, pid_children=None):
Yields:
DeviceProcessInfo: One instance for each process found in lookup.
"""
cmd = ["ps", "-A", "-o", "pid,ppid,rss,name"]
cmd = ["ps", "-o", "pid,ppid,rss,name"]
if pid is not None:
assert isinstance(pid, int)
cmd.append(str(pid))
if pid_children is not None:
assert isinstance(pid_children, int)
cmd += ["--ppid", str(pid_children)]
if not pid and not pid_children:
cmd.append("-A")
for line in self.shell(cmd, timeout=30)[1].splitlines()[1:]:
try:
proc_id, ppid, memory, name = line.split()
Expand Down

0 comments on commit 6f00ccb

Please sign in to comment.