Documentation
¶
Overview ¶
Package expect is a Go version of the classic TCL Expect.
Index ¶
- Constants
- type Expect
- func (e *Expect) Expect(pattern string, timeout time.Duration) (bool, error)
- func (e *Expect) ExpectAny(pattern string, re *regexp.Regexp, timeout time.Duration) (string, error)
- func (e *Expect) ExpectRe(re *regexp.Regexp, timeout time.Duration) (string, error)
- func (e *Expect) Interact() error
- func (e *Expect) Send(s string) (int, error)
- func (e *Expect) SendLine(s string) (int, error)
- func (e *Expect) String() string
- func (e *Expect) Wait() error
- func (e *Expect) Write(b []byte) (int, error)
- type PipeThrough
Constants ¶
View Source
const DefaultTimeout = 60 * time.Second
DefaultTimeout is the default expect timeout.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expect ¶
type Expect struct {
// contains filtered or unexported fields
}
func (*Expect) Expect ¶
Expect reads spawned processes output looking for pattern. Zero timeout means expect forever. Negative timeout means Default timeout.
func (*Expect) ExpectAny ¶
func (e *Expect) ExpectAny(pattern string, re *regexp.Regexp, timeout time.Duration) (string, error)
ExpectAny is similar to Expect, match string pattern or regexp re.
func (*Expect) Interact ¶
Interact gives control of the child process to the interactive user (the human at the keyboard).
type PipeThrough ¶
type PipeThrough struct {
// contains filtered or unexported fields
}
PipeThrough is a Reader with read deadline. If a timeout is reached, the error is returned. If the provided io.Reader reads error, the error is also returned.
func NewPipeThrough ¶
func NewPipeThrough(reader io.Reader) (*PipeThrough, error)
NewPassthroughPipe returns a new reader for a io.Reader with no read timeout.
func (*PipeThrough) Close ¶
func (pt *PipeThrough) Close() error
func (*PipeThrough) SetReadDeadline ¶
func (pt *PipeThrough) SetReadDeadline(t time.Time) error
Click to show internal directories.
Click to hide internal directories.