ReadUntilString emulates a terminal and reads one byte at a time until we either see the string we want, or the context expires. The PTY must be sized to 80x80 or there could be unexpected results.
(ctx context.Context, want string)
| 31 | // either see the string we want, or the context expires. The PTY must be sized |
| 32 | // to 80x80 or there could be unexpected results. |
| 33 | func (tr *TerminalReader) ReadUntilString(ctx context.Context, want string) error { |
| 34 | return tr.ReadUntil(ctx, func(line string) bool { |
| 35 | return strings.TrimSpace(line) == want |
| 36 | }) |
| 37 | } |
| 38 | |
| 39 | // ReadUntil emulates a terminal and reads one byte at a time until the matcher |
| 40 | // returns true or the context expires. If the matcher is nil, read until EOF. |