func (bct *BCasT) Arg() string {
	return ""
}
Arg returns an empty string , not used for SwitchCase.
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))
}
func (bs *BSig) Timeout() time.Duration {
	return time.Duration(0)
}
func (bs *BSig) Cases() []Caser {
	return nil
}
type BExp struct {
	R string
}
func (be *BExp) Cmd() int {
	return BatchExpect
}
func (be *BExp) Arg() string {
	return be.R
}
func (be *BExp) Timeout() time.Duration {
	return -1
}
func (be *BExp) Cases() []Caser {
	return nil
}
type BExpT struct {
	R string
	T int
}
func (bt *BExpT) Cmd() int {
	return BatchExpect
}
func (bt *BExpT) Timeout() time.Duration {
	return time.Duration(bt.T) * time.Second
}
func (bt *BExpT) Arg() string {
	return bt.R
}
func (bt *BExpT) Cases() []Caser {
	return nil
}
type BSnd struct {
	S string
}
func (bs *BSnd) Cmd() int {
	return BatchSend
}
func (bs *BSnd) Arg() string {
	return bs.S
}
func (bs *BSnd) Timeout() time.Duration {
	return 0
}
func (bs *BSnd) Cases() []Caser {
	return nil
}
type BCas struct {
	C []Caser
}
func (bc *BCas) Cmd() int {
	return BatchSwitchCase
}
func (bc *BCas) Arg() string {
	return ""
}
func (bc *BCas) Timeout() time.Duration {
	return -1
}
func (bc *BCas) Cases() []Caser {
	return bc.C
}
type BCasT struct {
	C []Caser
	T int
}
func (bct *BCasT) Timeout() time.Duration {
	return time.Duration(bct.T) * time.Second
}
func (bct *BCasT) Cmd() int {
	return BatchSwitchCase
}