Tread ERROR_MORE_DATA as success and return the remaining n number of bytes required to be read.

This commit is contained in:
Tejaswini Duggaraju
2018-05-25 13:37:14 -07:00
parent 211d6ebb39
commit 3f914f36b8
+3
View File
@@ -229,6 +229,9 @@ func (f *win32File) Read(b []byte) (int, error) {
return 0, io.EOF
} else if err == syscall.ERROR_BROKEN_PIPE {
return 0, io.EOF
// When there is more data in the message pipe to read, we get ERROR_MORE_DATA. We ignore that error and proceed to read more data
} else if err == syscall.ERROR_MORE_DATA && n != 0 && len(b) != 0 {
return n, nil
} else {
return n, err
}