Browse Source

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.
pull/21/head
relan 10 years ago committed by Daniel Martí
parent
commit
79e663e939
  1. 6
      adb/device.go

6
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 ""
}

Loading…
Cancel
Save