浏览代码

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 8 年之前
父节点
当前提交
97b572ea1b
共有 3 个文件被更改,包括 11 次插入2 次删除
  1. 2 1
      vendor.conf
  2. 4 0
      vendor/github.com/Microsoft/go-winio/file.go
  3. 5 1
      vendor/github.com/Microsoft/go-winio/pipe.go

+ 2 - 1
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

+ 4 - 0
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)
+}

+ 5 - 1
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
 	}