Add (*Watcher) ExpectWithTimeout

This commit is contained in:
HAYAMA_Kaoru
2024-11-29 12:49:11 +09:00
parent 0961e035fc
commit 9bca54b14e
2 changed files with 37 additions and 9 deletions
+4 -1
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"io"
"os"
"time"
"golang.org/x/term"
@@ -20,8 +21,10 @@ func loop(ptmx pty.Pty) error {
return err
}
_ = watcher.Expect("100")
i := watcher.ExpectWithTimeout(time.Duration(10*time.Second), "100")
// i := watcher.Expect("100")
io.WriteString(ptmx, "exit\r")
println(i)
return sh.Wait()
}