mirror of
https://github.com/golang/go.git
synced 2025-05-06 08:03:03 +00:00
misc/ios: retry app install
Sometimes ideviceinstaller fails to install the app. Retry a few times before giving up. For the iOS builder. Change-Id: Ib066ffd4f97ae8d22c0fa9a78ea4d04f67c17410 Reviewed-on: https://go-review.googlesource.com/111055 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
7b451dc715
commit
78cb5d7a68
@ -377,16 +377,26 @@ func findDeviceAppPath(bundleID string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func install(appdir string) error {
|
func install(appdir string) error {
|
||||||
|
attempt := 0
|
||||||
|
for {
|
||||||
cmd := idevCmd(exec.Command(
|
cmd := idevCmd(exec.Command(
|
||||||
"ideviceinstaller",
|
"ideviceinstaller",
|
||||||
"-i", appdir,
|
"-i", appdir,
|
||||||
))
|
))
|
||||||
if out, err := cmd.CombinedOutput(); err != nil {
|
if out, err := cmd.CombinedOutput(); err != nil {
|
||||||
|
// Sometimes, installing the app fails for some reason.
|
||||||
|
// Give the device a few seconds and try again.
|
||||||
|
if attempt < 5 {
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
attempt++
|
||||||
|
continue
|
||||||
|
}
|
||||||
os.Stderr.Write(out)
|
os.Stderr.Write(out)
|
||||||
return fmt.Errorf("ideviceinstaller -i %q: %v", appdir, err)
|
return fmt.Errorf("ideviceinstaller -i %q: %v (%d attempts)", appdir, err, attempt)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func idevCmd(cmd *exec.Cmd) *exec.Cmd {
|
func idevCmd(cmd *exec.Cmd) *exec.Cmd {
|
||||||
if deviceID != "" {
|
if deviceID != "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user