mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Windows: Don't close client stdin handle to avoid hang
Signed-off-by: John Howard (VM) <jhoward@microsoft.com>
This commit is contained in:
parent
4c7941d391
commit
91e971c0fe
1 changed files with 11 additions and 3 deletions
|
@ -105,11 +105,19 @@ func setRawTerminal(streams command.Streams) error {
|
||||||
func restoreTerminal(streams command.Streams, in io.Closer) error {
|
func restoreTerminal(streams command.Streams, in io.Closer) error {
|
||||||
streams.In().RestoreTerminal()
|
streams.In().RestoreTerminal()
|
||||||
streams.Out().RestoreTerminal()
|
streams.Out().RestoreTerminal()
|
||||||
// WARNING: DO NOT REMOVE THE OS CHECK !!!
|
// WARNING: DO NOT REMOVE THE OS CHECKS !!!
|
||||||
// For some reason this Close call blocks on darwin..
|
// For some reason this Close call blocks on darwin..
|
||||||
// As the client exists right after, simply discard the close
|
// As the client exits right after, simply discard the close
|
||||||
// until we find a better solution.
|
// until we find a better solution.
|
||||||
if in != nil && runtime.GOOS != "darwin" {
|
//
|
||||||
|
// This can also cause the client on Windows to get stuck in Win32 CloseHandle()
|
||||||
|
// in some cases. See https://github.com/docker/docker/issues/28267#issuecomment-288237442
|
||||||
|
// Tracked internally at Microsoft by VSO #11352156. In the
|
||||||
|
// Windows case, you hit this if you are using the native/v2 console,
|
||||||
|
// not the "legacy" console, and you start the client in a new window. eg
|
||||||
|
// `start docker run --rm -it microsoft/nanoserver cmd /s /c echo foobar`
|
||||||
|
// will hang. Remove start, and it won't repro.
|
||||||
|
if in != nil && runtime.GOOS != "darwin" && runtime.GOOS != "windows" {
|
||||||
return in.Close()
|
return in.Close()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue