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)
| 67 | // container, but the client stdin is not itself a terminal (for example, |
| 68 | // when input is piped or redirected). |
| 69 | func (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 |
no test coverage detected