func (bs *BSig) Timeout() time.Duration {
	return time.Duration(0)
}
Timeout always returns 0 for BSig.
package expect
import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"log"
	"os"
	"os/exec"
	"regexp"
	"strconv"
	"strings"
	"sync"
	"syscall"
	"time"
	"golang.org/x/crypto/ssh"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
	"github.com/google/goterm/term"
)
const DefaultTimeout = 60 * time.Second
const (
	checkDuration     = 2 * time.Second  
	defaultBufferSize = 8192             
)
type Status struct {
	code codes.Code
	msg  string
}
func NewStatus(code codes.Code, msg string) *Status {
	return &Status{code, msg}
}
func NewStatusf(code codes.Code, format string, a ...interface{}) *Status {
	return NewStatus(code, fmt.Sprintf(fmt.Sprintf(format, a...)))
}
func (s *Status) Err() error {
	if s == nil || s.code == codes.OK {
		return nil
	}
	return s
}
func (s *Status) Error() string {
	return s.msg
}
type Option func(*GExpect) Option
func CheckDuration(d time.Duration) Option {
	return func(e *GExpect) Option {
		prev := e.chkDuration
		e.chkDuration = d
		return CheckDuration(prev)
	}
}
func SendTimeout(timeout time.Duration) Option {
	return func(e *GExpect) Option {
		prev := e.sendTimeout
		e.sendTimeout = timeout
		return SendTimeout(prev)
	}
}
func Verbose(v bool) Option {
	return func(e *GExpect) Option {
		prev := e.verbose
		e.verbose = v
		return Verbose(prev)
	}
}
func VerboseWriter(w io.Writer) Option {
	return func(e *GExpect) Option {
		prev := e.verboseWriter
		e.verboseWriter = w
		return VerboseWriter(prev)
	}
}
func Tee(w io.WriteCloser) Option {
	return func(e *GExpect) Option {
		prev := e.teeWriter
		e.teeWriter = w
		return Tee(prev)
	}
}
func NoCheck() Option {
	return changeChk(func(*GExpect) bool {
		return true
	})
}
func DebugCheck(l *log.Logger) Option {
	lg := log.Printf
	if l != nil {
		lg = l.Printf
	}
	return func(e *GExpect) Option {
		prev := e.chk
		e.chkMu.Lock()
		e.chk = func(ge *GExpect) bool {
			res := prev(ge)
			ge.mu.Lock()
			lg("chk: %t, ge: %v", res, ge)
			ge.mu.Unlock()
			return res
		}
		e.chkMu.Unlock()
		return changeChk(prev)
	}
}
func ChangeCheck(f func() bool) Option {
	return changeChk(func(*GExpect) bool {
		return f()
	})
}
func changeChk(f func(*GExpect) bool) Option {
	return func(e *GExpect) Option {
		prev := e.chk
		e.chkMu.Lock()
		e.chk = f
		e.chkMu.Unlock()
		return changeChk(prev)
	}
}
func SetEnv(env []string) Option {
	return func(e *GExpect) Option {
		prev := e.cmd.Env
		e.cmd.Env = env
		return SetEnv(prev)
	}
}
func SetSysProcAttr(args *syscall.SysProcAttr) Option {
	return func(e *GExpect) Option {
		prev := e.cmd.SysProcAttr
		e.cmd.SysProcAttr = args
		return SetSysProcAttr(prev)
	}
}
func PartialMatch(v bool) Option {
	return func(e *GExpect) Option {
		prev := e.partialMatch
		e.partialMatch = v
		return PartialMatch(prev)
	}
}
func BufferSize(bufferSize int) Option {
	return func(e *GExpect) Option {
		e.bufferSizeIsSet = true
		prev := e.bufferSize
		e.bufferSize = bufferSize
		return BufferSize(prev)
	}
}
const (
	BatchSend = iota
	BatchExpect
	BatchSwitchCase
	BatchSendSignal
)
type TimeoutError int
func (t TimeoutError) Error() string {
	return fmt.Sprintf("expect: timer expired after %d seconds", time.Duration(t)/time.Second)
}
type BatchRes struct {
	Idx int
	Output string
	Match []string
}
type Batcher interface {
	Cmd() int
	Arg() string
	Timeout() time.Duration
	Cases() []Caser
}
type BSig struct {
	S syscall.Signal
}
func (bs *BSig) Cmd() int {
	return BatchSendSignal
}
func (bs *BSig) Arg() string {
	return strconv.Itoa(int(bs.S))
}