MCPcopy Create free account
hub / github.com/devspace-sh/devspace / SetupTTY

Function SetupTTY

pkg/util/terminal/tty.go:11–32  ·  view source on GitHub ↗

SetupTTY creates a term.TTY (docker)

(stdin io.Reader, stdout io.Writer)

Source from the content-addressed store, hash-verified

9
10// SetupTTY creates a term.TTY (docker)
11func 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}

Callers 5

client.goFile · 0.92
NewStdoutLoggerFunction · 0.92
runProxyCommandFunction · 0.92
TestTTYFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestTTYFunction · 0.68