Aim at the right emulator, and measure the right process
Two corrections from driving these against a live machine. A bare adb call made from a checkout whose own emulator is down was still handed through to whatever single device was attached -- which is another session's emulator, installing over the app they are looking at and taking their foreground, and looking like it worked. It now refuses and says which serials belong to whom. A physical phone belongs to no checkout and is left alone, which is why this asks for AVD names rather than counting devices. `emu list` was reporting 6 MB for a 3.8 GB emulator: it matched on a -port that is not in the process's command line at all, and the line it did match was the shell running the ps. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5d77599f3f
commit
e379edfc1b
2 files changed
+36
-4
No files matched your search
@@ -69,8 +69,33 @@ if [ -z "${ANDROID_SERIAL:-}" ]; then
|
||||
devices | start-server | kill-server | version | help | connect | disconnect) ;;
|
||||
*)
|
||||
if [ "$named" = false ]; then
|
||||
serial=$(avd_serial "$real" "$(project_avd)" || true)
|
||||
[ -n "$serial" ] && target=(-s "$serial")
|
||||
avd=$(project_avd)
|
||||
serial=$(avd_serial "$real" "$avd" || true)
|
||||
if [ -n "$serial" ]; then
|
||||
target=(-s "$serial")
|
||||
else
|
||||
# This checkout's emulator is not running, and something
|
||||
# else's is. Handing the call through would drive their
|
||||
# device -- installing over the app they are looking at,
|
||||
# or taking their foreground -- and it would look like it
|
||||
# worked. A physical phone is not somebody's checkout and
|
||||
# is left alone, which is why this asks for the AVD name
|
||||
# rather than counting devices.
|
||||
others=$(running_avds "$real" | awk -F'\t' -v mine="$avd" '$2 != mine')
|
||||
if [ -n "$others" ]; then
|
||||
{
|
||||
echo "adb: '$avd' is not running, and these emulators belong to other checkouts:"
|
||||
echo "$others" | while IFS=$'\t' read -r s n; do
|
||||
printf ' %-16s %s\n' "$s" "$n"
|
||||
done
|
||||
echo
|
||||
echo " emu up start this checkout's own"
|
||||
echo " adb -s SERIAL ... or say which you meant"
|
||||
echo " ANDROID_SERIAL=SERIAL for a run of them"
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in new issue
Block a user