From 79e663e939bcfbb557e758b8c6872dbbe5e52b74 Mon Sep 17 00:00:00 2001 From: relan Date: Sun, 9 Oct 2016 21:58:02 +0300 Subject: [PATCH] Fix parsing of adb uninstall error with a prefix Adb can print error in the following format: Failed to install example.apk: Failure [INSTALL_...: Explanation.] So we should not expect "Failure" at the beginning of output. --- adb/device.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/adb/device.go b/adb/device.go index 5fc5ebc..4ef115c 100644 --- a/adb/device.go +++ b/adb/device.go @@ -166,9 +166,13 @@ func getResultLine(output []byte) string { scanner := bufio.NewScanner(bytes.NewReader(output)) for scanner.Scan() { l := scanner.Text() - if strings.HasPrefix(l, "Failure") || strings.HasPrefix(l, "Success") { + if strings.HasPrefix(l, "Success") { return l } + failure := strings.Index(l, "Failure") + if failure >= 0 { + return l[failure:] + } } return "" }