1
0
Fork 0

Try creating a new session in ssh check

timestamps
dump_stack() 2023-05-07 15:24:10 +00:00
parent e8a446ec76
commit 0826948568
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
1 changed files with 15 additions and 1 deletions

View File

@ -337,11 +337,25 @@ func (q *System) Stop() {
func (q System) WaitForSSH(timeout time.Duration) error {
for start := time.Now(); time.Since(start) < timeout; {
time.Sleep(time.Second / 4)
client, err := q.ssh("root")
if err != nil {
time.Sleep(time.Second / 10)
continue
}
session, err := client.NewSession()
if err != nil {
client.Close()
continue
}
_, err = session.CombinedOutput("echo")
if err != nil {
client.Close()
continue
}
client.Close()
return nil
}