【发布时间】:2014-11-12 15:51:45
【问题描述】:
我研究的相关问题:
How to get Android AVD name from serial number
我们有以下解决方案:
(sleep 0.5; echo 'avd name') | telnet 127.0.0.1 5554
我在 2 个操作系统上工作:OS X Yosemite 和一个 Debian VM。更改sleep 时间并不重要。
我在每个系统中启动一个模拟器。 adb devices 显示一切正确:emulator-5554 device。现在我正在尝试获取正在运行的模拟器的名称。
在 OS X 上会发生什么:
(sleep 1; echo "avd name") | telnet 127.0.0.1 5554
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
Connection closed by foreign host.
在 Debian 上会发生什么:
(sleep 1; echo "avd name") | telnet localhost 5554
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
emu_19_WVGA800
OK
Connection closed by foreign host.
但有时它会失败,它根本不稳定,有时它与 OS X 一样失败。
也试过这个:{echo open 127.0.0.1 5554; sleep 1; echo "avd name"} | telnet。这具有完全相同的输出:它在 OS X 上失败,有时在 Debian 上成功。
请给我一个提示:这种不同的行为是什么?为什么会如此不稳定?
【问题讨论】: