pid: switch to pgrep.
Fix a bug where processes that didn't have a leading space from right justification of the pid column would return the process name instead of the pid, by switching to pgrep. Bug: http://b/111748205 Test: manual Change-Id: I3493474540ccfa89f5bb3e66153d9e96ec8bf1d9
This commit is contained in:
@@ -28,12 +28,10 @@ fi
|
|||||||
|
|
||||||
if [ $EXACT == 1 ]; then
|
if [ $EXACT == 1 ]; then
|
||||||
PIDS="$(adb shell pidof $EXE)"
|
PIDS="$(adb shell pidof $EXE)"
|
||||||
RC=$?
|
|
||||||
else
|
else
|
||||||
PIDS=$(adb shell "ps -o PID,NAME | tail -n +1 | grep $EXE | tr -s ' ' | cut -f2 -d' '")
|
PIDS="$(adb shell pgrep -f $EXE)"
|
||||||
[ -n "$PIDS" ]
|
|
||||||
RC=$?
|
|
||||||
fi
|
fi
|
||||||
|
RC=$?
|
||||||
|
|
||||||
for PID in $PIDS; do
|
for PID in $PIDS; do
|
||||||
echo $PID
|
echo $PID
|
||||||
|
|||||||
Reference in New Issue
Block a user