|
@@ -2,9 +2,11 @@ package command
|
|
|
|
|
|
import (
|
|
|
"errors"
|
|
|
- "github.com/docker/docker/pkg/term"
|
|
|
"io"
|
|
|
+ "os"
|
|
|
"runtime"
|
|
|
+
|
|
|
+ "github.com/docker/docker/pkg/term"
|
|
|
)
|
|
|
|
|
|
// InStream is an input stream used by the DockerCli to read user input
|
|
@@ -22,6 +24,15 @@ func (i *InStream) Close() error {
|
|
|
return i.in.Close()
|
|
|
}
|
|
|
|
|
|
+// SetRawTerminal sets raw mode on the input terminal
|
|
|
+func (i *InStream) SetRawTerminal() (err error) {
|
|
|
+ if os.Getenv("NORAW") != "" || !i.CommonStream.isTerminal {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ i.CommonStream.state, err = term.SetRawTerminal(i.CommonStream.fd)
|
|
|
+ return err
|
|
|
+}
|
|
|
+
|
|
|
// CheckTty checks if we are trying to attach to a container tty
|
|
|
// from a non-tty client input stream, and if so, returns an error.
|
|
|
func (i *InStream) CheckTty(attachStdin, ttyMode bool) error {
|