From f3cc477e7d7a274cf3d7177baaafaa4221f6d676 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 --- vendor.conf | 3 ++- vendor/github.com/Microsoft/go-winio/file.go | 4 ++++ vendor/github.com/Microsoft/go-winio/pipe.go | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/vendor.conf b/vendor.conf index d3835c5fc9..7f93cfc74b 100644 --- a/vendor.conf +++ b/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/vendor/github.com/Microsoft/go-winio/file.go b/vendor/github.com/Microsoft/go-winio/file.go index 8c15e4124c..231863c811 100644 --- a/vendor/github.com/Microsoft/go-winio/file.go +++ b/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/vendor/github.com/Microsoft/go-winio/pipe.go b/vendor/github.com/Microsoft/go-winio/pipe.go index b85b2eef46..e1b02580d0 100644 --- a/vendor/github.com/Microsoft/go-winio/pipe.go +++ b/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 }