From 091ef8a74e6a17564404c3d8c795bbe51e979b2d Mon Sep 17 00:00:00 2001 From: rxwen Date: Thu, 13 Aug 2015 21:35:13 +0800 Subject: [PATCH] improve fix for issue-338 - replace all occurence of : to \: - consider the case there are multiple tcp adb connections $ adb devices List of devices attached 192.168.0.139:5555 device 192.168.0.225:5555 device all of colon has to be replaced, otherwise, we get this wrong result: $ adb -s 192.168.0. 192.168.0.139:5555 -- connected device 192.168.0.225 -- 5555:connected device --- src/_adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_adb b/src/_adb index 9d19935..6e252e7 100644 --- a/src/_adb +++ b/src/_adb @@ -253,7 +253,7 @@ _adb_product_names() { (( $+functions[_adb_serial_numbers] )) || _adb_serial_numbers() { - local serial_numbers; serial_numbers=(${${(M)${(f)"$(_call_program devices $service devices)"/:/\\:}:#*device}%%[[:space:]]*}":connected device") + local serial_numbers; serial_numbers=(${${(M)${(f)"$(_call_program devices $service devices)"//:/\\:}:#*device}%%[[:space:]]*}":connected device") [[ -n "$ANDROID_SERIAL" ]] && serial_numbers+=("$ANDROID_SERIAL:default value set in ANDROID_SERIAL environment variable") _describe -t serial-numbers 'serial number' serial_numbers "$@" && ret=0 }