SetupTTY creates a term.TTY (docker)
(stdin io.Reader, stdout io.Writer)
| 9 | |
| 10 | // SetupTTY creates a term.TTY (docker) |
| 11 | func SetupTTY(stdin io.Reader, stdout io.Writer) (bool, term.TTY) { |
| 12 | t := term.TTY{ |
| 13 | Out: stdout, |
| 14 | In: stdin, |
| 15 | } |
| 16 | |
| 17 | if !t.IsTerminalIn() { |
| 18 | return false, t |
| 19 | } |
| 20 | |
| 21 | // if we get to here, the user wants to attach stdin, wants a TTY, and In is a terminal, so we |
| 22 | // can safely set t.Raw to true |
| 23 | t.Raw = true |
| 24 | |
| 25 | newStdin, newStdout, _ := dockerterm.StdStreams() |
| 26 | t.In = newStdin |
| 27 | if stdout != nil { |
| 28 | t.Out = newStdout |
| 29 | } |
| 30 | |
| 31 | return true, t |
| 32 | } |
no outgoing calls