aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorVincent Demeester <vincent@demeester.fr>2017-04-25 18:25:05 +0200
committerVincent Demeester <vincent@demeester.fr>2017-04-25 18:25:05 +0200
commit8c014db3027b1ddecd42389e24b9c46d5f7a93ae (patch)
treeaf3de16683e5be41384ffb363bdf6ff8d6c970ee /cli
parente1101b1295f05ef3c6f1a684a51cd508b3c7874c (diff)
Fix docker run -it on windows
Signed-off-by: Vincent Demeester <vincent@demeester.fr>
Diffstat (limited to 'cli')
-rw-r--r--cli/command/in.go13
-rw-r--r--cli/command/out.go13
-rw-r--r--cli/command/stream.go10
3 files changed, 24 insertions, 12 deletions
diff --git a/cli/command/in.go b/cli/command/in.go
index 815d2a2028..54855c6dc2 100644
--- a/cli/command/in.go
+++ b/cli/command/in.go
@@ -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 {
diff --git a/cli/command/out.go b/cli/command/out.go
index 622e758cc4..27b44c235d 100644
--- a/cli/command/out.go
+++ b/cli/command/out.go
@@ -1,9 +1,11 @@
package command
import (
+ "io"
+ "os"
+
"github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/term"
- "io"
)
// OutStream is an output stream used by the DockerCli to write normal program
@@ -17,6 +19,15 @@ func (o *OutStream) Write(p []byte) (int, error) {
return o.out.Write(p)
}
+// SetRawTerminal sets raw mode on the input terminal
+func (o *OutStream) SetRawTerminal() (err error) {
+ if os.Getenv("NORAW") != "" || !o.CommonStream.isTerminal {
+ return nil
+ }
+ o.CommonStream.state, err = term.SetRawTerminalOutput(o.CommonStream.fd)
+ return err
+}
+
// GetTtySize returns the height and width in characters of the tty
func (o *OutStream) GetTtySize() (uint, uint) {
if !o.isTerminal {
diff --git a/cli/command/stream.go b/cli/command/stream.go
index 13a54cc672..71a43fa2e9 100644
--- a/cli/command/stream.go
+++ b/cli/command/stream.go
@@ -2,7 +2,6 @@ package command
import (
"github.com/docker/docker/pkg/term"
- "os"
)
// CommonStream is an input stream used by the DockerCli to read user input
@@ -22,15 +21,6 @@ func (s *CommonStream) IsTerminal() bool {
return s.isTerminal
}
-// SetRawTerminal sets raw mode on the input terminal
-func (s *CommonStream) SetRawTerminal() (err error) {
- if os.Getenv("NORAW") != "" || !s.isTerminal {
- return nil
- }
- s.state, err = term.SetRawTerminal(s.fd)
- return err
-}
-
// RestoreTerminal restores normal mode to the terminal
func (s *CommonStream) RestoreTerminal() {
if s.state != nil {