修复掉线仍然安装成功的问题

This commit is contained in:
余泓铮
2025-02-24 12:02:04 +08:00
parent 165aab0dc8
commit e139205a10
+11 -10
View File
@@ -640,16 +640,17 @@ func (d *Device) InstallAPK(apkPath string, args ...string) (string, error) {
haserr := func(ret string) bool { haserr := func(ret string) bool {
return strings.Contains(ret, "Failure") return strings.Contains(ret, "Failure")
} }
if d.HasFeature(FeatAbbExec) { // 该方法掉线不会返回error。导致误认为安装成功
raw, err := d.installViaABBExec(apkFile) //if d.HasFeature(FeatAbbExec) {
if err != nil { // raw, err := d.installViaABBExec(apkFile)
return "", fmt.Errorf("error installing: %v", err) // if err != nil {
} // return "", fmt.Errorf("error installing: %v", err)
if haserr(string(raw)) { // }
return "", errors.New(string(raw)) // if haserr(string(raw)) {
} // return "", errors.New(string(raw))
return string(raw), err // }
} // return string(raw), err
//}
remote := fmt.Sprintf("/data/local/tmp/%s.apk", builtin.GenNameWithTimestamp("gadb_remote_%d")) remote := fmt.Sprintf("/data/local/tmp/%s.apk", builtin.GenNameWithTimestamp("gadb_remote_%d"))
err = d.Push(apkFile, remote, time.Now()) err = d.Push(apkFile, remote, time.Now())