From 7ea495470a849b2104f6474fb40ba43fdb3192a0 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Tue, 21 Mar 2017 11:36:47 +0100 Subject: [PATCH] Windows: Fix Docker hanging with named pipes and stdin Fixes #31922 Vendor a fork of Microsoft/go-winio that has this PR (https://github.com/Microsoft/go-winio/pull/43) merged Signed-off-by: David Gageot Upstream-commit: 97b572ea1ba05fadbae5e29335489a04b5b3b123 Component: engine --- components/engine/vendor.conf | 3 ++- .../engine/vendor/github.com/Microsoft/go-winio/file.go | 4 ++++ .../engine/vendor/github.com/Microsoft/go-winio/pipe.go | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/components/engine/vendor.conf b/components/engine/vendor.conf index 917f886627..a784d402ba 100644 --- a/components/engine/vendor.conf +++ b/components/engine/vendor.conf @@ -1,7 +1,8 @@ # the following lines are in sorted order, FYI github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62 github.com/Microsoft/hcsshim v0.5.12 -github.com/Microsoft/go-winio v0.3.8 +# TODO: get rid of this fork once PR https://github.com/Microsoft/go-winio/pull/43 is merged +github.com/Microsoft/go-winio 7c7d6b461cb10872c1138a0d7f3acf9a41b5c353 https://github.com/dgageot/go-winio.git github.com/Sirupsen/logrus v0.11.0 github.com/davecgh/go-spew 6d212800a42e8ab5c146b8ace3490ee17e5225f9 github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a diff --git a/components/engine/vendor/github.com/Microsoft/go-winio/file.go b/components/engine/vendor/github.com/Microsoft/go-winio/file.go index 8c15e4124c..231863c811 100644 --- a/components/engine/vendor/github.com/Microsoft/go-winio/file.go +++ b/components/engine/vendor/github.com/Microsoft/go-winio/file.go @@ -219,3 +219,7 @@ func (f *win32File) SetWriteDeadline(t time.Time) error { f.writeDeadline = t return nil } + +func (f *win32File) Flush() error { + return syscall.FlushFileBuffers(f.handle) +} diff --git a/components/engine/vendor/github.com/Microsoft/go-winio/pipe.go b/components/engine/vendor/github.com/Microsoft/go-winio/pipe.go index b85b2eef46..e1b02580d0 100644 --- a/components/engine/vendor/github.com/Microsoft/go-winio/pipe.go +++ b/components/engine/vendor/github.com/Microsoft/go-winio/pipe.go @@ -87,7 +87,11 @@ func (f *win32MessageBytePipe) CloseWrite() error { if f.writeClosed { return errPipeWriteClosed } - _, err := f.win32File.Write(nil) + err := f.win32File.Flush() + if err != nil { + return err + } + _, err = f.win32File.Write(nil) if err != nil { return err }