Browse code

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 <david@gageot.net>

David Gageot authored on 2017/03/21 19:36:47
Showing 3 changed files
... ...
@@ -1,7 +1,8 @@
1 1
 # the following lines are in sorted order, FYI
2 2
 github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
3 3
 github.com/Microsoft/hcsshim v0.5.12
4
-github.com/Microsoft/go-winio v0.3.8
4
+# TODO: get rid of this fork once PR https://github.com/Microsoft/go-winio/pull/43 is merged
5
+github.com/Microsoft/go-winio 7c7d6b461cb10872c1138a0d7f3acf9a41b5c353 https://github.com/dgageot/go-winio.git
5 6
 github.com/Sirupsen/logrus v0.11.0
6 7
 github.com/davecgh/go-spew 6d212800a42e8ab5c146b8ace3490ee17e5225f9
7 8
 github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
... ...
@@ -219,3 +219,7 @@ func (f *win32File) SetWriteDeadline(t time.Time) error {
219 219
 	f.writeDeadline = t
220 220
 	return nil
221 221
 }
222
+
223
+func (f *win32File) Flush() error {
224
+	return syscall.FlushFileBuffers(f.handle)
225
+}
... ...
@@ -87,7 +87,11 @@ func (f *win32MessageBytePipe) CloseWrite() error {
87 87
 	if f.writeClosed {
88 88
 		return errPipeWriteClosed
89 89
 	}
90
-	_, err := f.win32File.Write(nil)
90
+	err := f.win32File.Flush()
91
+	if err != nil {
92
+		return err
93
+	}
94
+	_, err = f.win32File.Write(nil)
91 95
 	if err != nil {
92 96
 		return err
93 97
 	}