Merge pull request #146 from microsoft/fix-makeopenfile

Fix interface-wrapped nil returned by MakeOpenFile
This commit is contained in:
Justin
2019-06-28 11:17:19 -07:00
committed by GitHub
+7 -1
View File
@@ -111,7 +111,13 @@ func makeWin32File(h syscall.Handle) (*win32File, error) {
}
func MakeOpenFile(h syscall.Handle) (io.ReadWriteCloser, error) {
return makeWin32File(h)
// If we return the result of makeWin32File directly, it can result in an
// interface-wrapped nil, rather than a nil interface value.
f, err := makeWin32File(h)
if err != nil {
return nil, err
}
return f, nil
}
// closeHandle closes the resources associated with a Win32 handle