Fix docker run -it on windows

Signed-off-by: Vincent Demeester <vincent@demeester.fr>
This commit is contained in:
Vincent Demeester
2017-04-25 18:25:05 +02:00
committed by Tibor Vass
parent 5b6bd92862
commit c67589a52c
3 changed files with 24 additions and 12 deletions

View File

@ -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 {