stacks: match exactly before matching nonexactly.
`pid zygote` will match zygote64 as well, but someone using `stacks
zygote` clearly wants the 32-bit version. Attempt an exact match before
we try a nonexact one.
Test: stacks zygote
Test: stacks zygote64
Change-Id: I5fd75cdbe4982c7ea831749c9ba823a2451e5490
diff --git a/scripts/stacks b/scripts/stacks
index 7f4bb5a..f66b7b3 100755
--- a/scripts/stacks
+++ b/scripts/stacks
@@ -17,7 +17,8 @@
if [[ $1 =~ ^[0-9]+$ ]] ; then
PID="$1"
elif [ "$1" ] ; then
- PIDLIST="$(pid $1)"
+ # Try --exact first, and fallback to nonexact if we find nothing.
+ PIDLIST="$(pid --exact $1 || pid $1)"
if [[ $PIDLIST =~ ^[0-9]+$ ]] ; then
PID="$PIDLIST"
elif [ "$PIDLIST" ] ; then