deploy: try to restart adb server on dev timeout
This commit is contained in:
parent
43ef704a32
commit
01cab85f6b
|
@ -230,7 +230,24 @@ var deployCmd = &cobra.Command{
|
||||||
for i := 0; i <= 120; i++ {
|
for i := 0; i <= 120; i++ {
|
||||||
if i == 120 {
|
if i == 120 {
|
||||||
ofoxSpinner.Stop()
|
ofoxSpinner.Stop()
|
||||||
logger.Error("Recovery device timeout")
|
logger.Warn("Recovery device timeout")
|
||||||
|
logger.Info("Trying to restart adb server")
|
||||||
|
err := adbc.KillServer();
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("Failed to kill server")
|
||||||
|
os.Exit(173);
|
||||||
|
}
|
||||||
|
err = adbc.StartServer();
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("Failed to start server")
|
||||||
|
os.Exit(173);
|
||||||
|
}
|
||||||
|
adbd = adbc.Device(adb.DeviceWithSerial(serail));
|
||||||
|
if s, _ := adbd.State(); s == adb.StateRecovery {
|
||||||
|
logger.Info("Device found")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
logger.Error("Device not found")
|
||||||
os.Exit(173)
|
os.Exit(173)
|
||||||
}
|
}
|
||||||
if s, _ := adbd.State(); s == adb.StateRecovery {
|
if s, _ := adbd.State(); s == adb.StateRecovery {
|
||||||
|
@ -276,7 +293,24 @@ var deployCmd = &cobra.Command{
|
||||||
for i := 0; i <= 120; i++ {
|
for i := 0; i <= 120; i++ {
|
||||||
if i == 120 {
|
if i == 120 {
|
||||||
ofoxSpinner.Stop()
|
ofoxSpinner.Stop()
|
||||||
logger.Error("Recovery device timeout")
|
logger.Warn("Recovery device timeout")
|
||||||
|
logger.Info("Trying to restart adb server")
|
||||||
|
err := adbc.KillServer();
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("Failed to kill server")
|
||||||
|
os.Exit(173);
|
||||||
|
}
|
||||||
|
err = adbc.StartServer();
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("Failed to start server")
|
||||||
|
os.Exit(173);
|
||||||
|
}
|
||||||
|
adbd = adbc.Device(adb.DeviceWithSerial(serail));
|
||||||
|
if s, _ := adbd.State(); s == adb.StateRecovery {
|
||||||
|
logger.Info("Device found")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
logger.Error("Device not found")
|
||||||
os.Exit(173)
|
os.Exit(173)
|
||||||
}
|
}
|
||||||
if s, _ := adbd.State(); s == adb.StateRecovery {
|
if s, _ := adbd.State(); s == adb.StateRecovery {
|
||||||
|
@ -286,6 +320,7 @@ var deployCmd = &cobra.Command{
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
port, err := utils.GetFreePort()
|
port, err := utils.GetFreePort()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("Failled to find free tcp port")
|
logger.Error("Failled to find free tcp port")
|
||||||
|
|
Loading…
Reference in a new issue