1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

[pkg/term] temporarily use STD_*_HANDLE from syscall again

Due to the CL https://go-review.googlesource.com/c/39608/ in
x/sys/windows which changed the definitions of STD_INPUT_HANDLE,
STD_OUTPUT_HANDLE and STD_ERROR_HANDLE, we get the following failure
after re-vendoring x/sys/windows:

  07:47:01 # github.com/docker/docker/pkg/term
  07:47:01 pkg/term/term_windows.go:82: constant 4294967286 overflows int
  07:47:01 pkg/term/term_windows.go:88: constant 4294967285 overflows int
  07:47:01 pkg/term/term_windows.go:94: constant 4294967284 overflows int
  07:47:12 Build step 'Execute shell' marked build as failure

Temporarily switch back pkg/term to use these constants from the syscall
package and add a comment about it.

To really fix this, go-ansiterm should probably be switched to use
x/sys/windows.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit is contained in:
Tobias Klauser 2017-06-08 08:52:21 +02:00
parent e769da88e6
commit ef5252fc5d

View file

@ -6,10 +6,10 @@ import (
"io"
"os"
"os/signal"
"syscall" // used for STD_INPUT_HANDLE, STD_OUTPUT_HANDLE and STD_ERROR_HANDLE
"github.com/Azure/go-ansiterm/winterm"
"github.com/docker/docker/pkg/term/windows"
"golang.org/x/sys/windows"
)
// State holds the console mode for the terminal.
@ -78,20 +78,24 @@ func StdStreams() (stdIn io.ReadCloser, stdOut, stdErr io.Writer) {
emulateStderr = false
}
// Temporarily use STD_INPUT_HANDLE, STD_OUTPUT_HANDLE and
// STD_ERROR_HANDLE from syscall rather than x/sys/windows as long as
// go-ansiterm hasn't switch to x/sys/windows.
// TODO: switch back to x/sys/windows once go-ansiterm has switched
if emulateStdin {
stdIn = windowsconsole.NewAnsiReader(windows.STD_INPUT_HANDLE)
stdIn = windowsconsole.NewAnsiReader(syscall.STD_INPUT_HANDLE)
} else {
stdIn = os.Stdin
}
if emulateStdout {
stdOut = windowsconsole.NewAnsiWriter(windows.STD_OUTPUT_HANDLE)
stdOut = windowsconsole.NewAnsiWriter(syscall.STD_OUTPUT_HANDLE)
} else {
stdOut = os.Stdout
}
if emulateStderr {
stdErr = windowsconsole.NewAnsiWriter(windows.STD_ERROR_HANDLE)
stdErr = windowsconsole.NewAnsiWriter(syscall.STD_ERROR_HANDLE)
} else {
stdErr = os.Stderr
}