1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 20:11:20 +00:00

Merge pull request #76 from ep1cman/get_pid_fix

AndroidDevice: fixed get_pids_of
This commit is contained in:
setrofim 2016-01-13 17:15:12 +00:00
commit 75ce620e6b

View File

@ -456,9 +456,10 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
def get_pids_of(self, process_name):
"""Returns a list of PIDs of all processes with the specified name."""
result = self.execute('ps {}'.format(process_name[-15:]), check_exit_code=False).strip()
result = self.execute('ps | {} grep {}'.format(self.busybox, process_name),
check_exit_code=False).strip()
if result and 'not found' not in result:
return [int(x.split()[1]) for x in result.split('\n')[1:]]
return [int(x.split()[1]) for x in result.split('\n')]
else:
return []