MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / inIsTTY

Function inIsTTY

internal/cli/provider_cmd.go:637–647  ·  view source on GitHub ↗

inIsTTY reports whether the supplied reader is a *os.File backed by a terminal. Tests using bytes.Buffer return false, which is what we want so the buffer-driven test path doesn't block on a confirmation prompt.

(in io.Reader)

Source from the content-addressed store, hash-verified

635// terminal. Tests using bytes.Buffer return false, which is what we want
636// so the buffer-driven test path doesn't block on a confirmation prompt.
637func inIsTTY(in io.Reader) bool {
638 file, ok := in.(*os.File)
639 if !ok {
640 return false
641 }
642 info, err := file.Stat()
643 if err != nil {
644 return false
645 }
646 return info.Mode()&os.ModeCharDevice != 0
647}
648
649// readLine reads up to a newline from in. Used only on the interactive
650// confirmation path; bounded read so we don't hang on a closed stdin.

Callers 1

providerRemoveCommandMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected