MCPcopy Index your code
hub / github.com/docker/cli / CheckTty

Method CheckTty

cli/streams/in.go:69–75  ·  view source on GitHub ↗

CheckTty reports an error when stdin is requested for a TTY-enabled container, but the client stdin is not itself a terminal (for example, when input is piped or redirected).

(attachStdin, ttyMode bool)

Source from the content-addressed store, hash-verified

67// container, but the client stdin is not itself a terminal (for example,
68// when input is piped or redirected).
69func (i *In) CheckTty(attachStdin, ttyMode bool) error {
70 // TODO(thaJeztah): consider inlining this code and deprecating the method.
71 if !ttyMode || !attachStdin || i.cs.isTerminal() {
72 return nil
73 }
74 return errors.New("cannot attach stdin to a TTY-enabled container because stdin is not a terminal")
75}
76
77// SetIsTerminal overrides whether a terminal is connected. It is used to
78// override this property in unit-tests, and should not be depended on for

Callers 3

RunAttachFunction · 0.80
RunExecFunction · 0.80
runContainerFunction · 0.80

Calls 1

isTerminalMethod · 0.80

Tested by

no test coverage detected