// TtyReady checks if the tty is ready to go
540876
func TtyReady() error {
	var err error

	_stdin, err := os.Open("CONIN$")
	if err != nil {
		return err
	}
	stdin = os.Stdin
	os.Stdin = _stdin
	syscall.Stdin = syscall.Handle(os.Stdin.Fd())

	return errors.Wrap(setStdHandle(syscall.STD_INPUT_HANDLE, syscall.Stdin), "failed to check for TtyReady")
}
1158251
func (t *TermHandlers) HandlePTYReq(ch ssh.Channel, req *ssh.Request, ctx *ServerContext) error {
	// parse and extract the requested window size of the pty
	ptyRequest, err := parsePTYReq(req)
	if err != nil {
		return trace.Wrap(err)
	}

	termModes, err := ptyRequest.TerminalModes()
	if err != nil {
		return trace.Wrap(err)
	}

	params, err := rsession.NewTerminalParamsFromUint32(ptyRequest.W, ptyRequest.H)
	if err != nil {
		return trace.Wrap(err)
	}
	ctx.Debugf("Requested terminal %q of size %v", ptyRequest.Env, *params)

	// get an existing terminal or create a new one
	term := ctx.GetTerm()
	if term == nil {
		// a regular or forwarding terminal will be allocated
		term, err = NewTerminal(ctx)
		if err != nil {
			return trace.Wrap(err)
		}
		ctx.SetTerm(term)
	}
	term.SetWinSize(*params)
	term.SetTermType(ptyRequest.Env)
	term.SetTerminalModes(termModes)

	// update the session
	if err := t.SessionRegistry.NotifyWinChange(*params, ctx); err != nil {
		ctx.Errorf("Unable to update session: %v", err)
	}

	return nil
}
780907
func (rw *BoundedRWLock) RLock(timeout time.Duration) (err error) {
	deadline := time.After(timeout)
	rw.control.Lock()
	if rw.nextWriter != nil {
		me := newWait(false)
		select {
		case rw.waiters <- me:
		default:
			err = errors.New("Waiter capacity reached in RLock")
		}
		rw.control.Unlock()
		if err != nil {
			return
		}

		woken := me.WaitAtomic(deadline)
		if !woken {
			return errors.New("Waiter timeout")
		}
	} else {
		rw.readers++
		rw.control.Unlock()
	}
	return
}
986776
func (m *MockInstance) WaitUntilReady(arg0 manifest0.Registry, arg1 ui.Stage) error {
	ret := m.ctrl.Call(m, "WaitUntilReady", arg0, arg1)
	ret0, _ := ret[0].(error)
	return ret0
}
836205
func (b *InsertBuilder) TTL(d time.Duration) *InsertBuilder {
	b.using.TTL(d)
	return b
}
434287
func (d DefaultRetryer) ShouldRetry(r *request.Request) bool {
	// If one of the other handlers already set the retry state
	// we don't want to override it based on the service's state
	if r.Retryable != nil {
		return *r.Retryable
	}

	if r.HTTPResponse.StatusCode >= 500 && r.HTTPResponse.StatusCode != 501 {
		return true
	}
	return r.IsErrorRetryable() || d.shouldThrottle(r)
}
1360184
func tty() string {
	dest, err := os.Readlink(fd0)
	if err != nil {
		return ""
	}
	return dest
}
35544
func (c *Conn) WaitUntilReady(ctx context.Context) error {
	err := c.waitForPreviousCancelQuery(ctx)
	if err != nil {
		return err
	}
	return c.ensureConnectionReadyForQuery()
}
1199488
func (b *UpdateBuilder) TTLNamed(name string) *UpdateBuilder {
	b.using.TTLNamed(name)
	return b
}
589669
func (L *State) NewThread() *State {
	//TODO: call newState with result from C.lua_newthread and return it
	//TODO: should have same lists as parent
	//		but may complicate gc
	s := C.lua_newthread(L.s)
	return &State{s, 0, nil, nil}
}
1158864
func (b *BatchBuilder) TTLNamed(name string) *BatchBuilder {
	b.using.TTLNamed(name)
	return b
}
786991
func isRetryNeeded(err error, fn string, key string, retryCount int) (bool, error) {
	switch err {
	case kvdb.ErrNotSupported, kvdb.ErrWatchStopped, kvdb.ErrNotFound, kvdb.ErrExist, kvdb.ErrUnmarshal, kvdb.ErrValueMismatch, kvdb.ErrModified:
		// For all known kvdb errors no retry is needed
		return false, err
	case rpctypes.ErrGRPCEmptyKey:
		return false, kvdb.ErrNotFound
	default:
		// For all other errors retry
		logrus.Errorf("[%v: %v] kvdb error: %v, retry count %v \n", fn, key, err, retryCount)
		return true, err
	}
}
701727
func (config *Config) IsTTY() bool {
	if config.ENV.ForceTTY != "" {
		envVal, err := strconv.ParseBool(config.ENV.ForceTTY)
		if err == nil {
			return envVal
		}
	}

	return config.detectedSettings.tty
}
552923
func IsNodeReady(node *Node) bool {
	for _, c := range node.Status.Conditions {
		if c.Type == NodeReady {
			return c.Status == ConditionTrue
		}
	}
	return false
}
983489
func (s *sourcesImpl) AllReady() bool {
	s.lock.RLock()
	defer s.lock.RUnlock()
	return s.sourcesReadyFn(s.sourcesSeen)
}
247658
func NewTask(name, driver string) *Task {
	return &Task{
		Name:   name,
		Driver: driver,
	}
}
149334
func Ready(count int) *Command {
	var params = [][]byte{[]byte(strconv.Itoa(count))}
	return &Command{[]byte("RDY"), params, nil}
}