[Git][ghc/ghc][wip/T25281] Missing record selectors in GHC.Internal.IO.Windows.Handle

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Wed Oct 9 07:24:04 UTC 2024



Simon Peyton Jones pushed to branch wip/T25281 at Glasgow Haskell Compiler / GHC


Commits:
0c68c409 by Simon Peyton Jones at 2024-10-09T08:23:48+01:00
Missing record selectors in GHC.Internal.IO.Windows.Handle

This look genuinely wrong.  These two fixes need auditing;
but they are better than the status quo.

- - - - -


1 changed file:

- libraries/ghc-internal/src/GHC/Internal/IO/Windows/Handle.hsc


Changes:

=====================================
libraries/ghc-internal/src/GHC/Internal/IO/Windows/Handle.hsc
=====================================
@@ -468,7 +468,10 @@ hwndReadNonBlocking hwnd ptr offset bytes
        val <- withOverlappedEx mngr "hwndReadNonBlocking" (toHANDLE hwnd)
                                (isAsynchronous hwnd) offset (startCB ptr)
                                completionCB
-       return $ ioValue val
+       return $ case val of
+                   IOSuccess mb_v  -> mb_v
+                   IOFailed mb_err -> error ("hwndReadNonBlocking " ++ show mb_err)
+                       -- ToDo: this unhandled errror case seems bad
   where
     startCB inputBuf lpOverlapped = do
       debugIO ":: hwndReadNonBlocking"
@@ -514,7 +517,11 @@ hwndWriteNonBlocking hwnd ptr offset bytes
        val <- withOverlappedEx mngr "hwndReadNonBlocking" (toHANDLE hwnd)
                                (isAsynchronous hwnd) offset (startCB ptr)
                                completionCB
-       return $ fromIntegral $ ioValue val
+       return $ fromIntegral $
+         case val of
+            IOSuccess val   -> val
+            IOFailed mb_err -> error ("hwndWriteNonBlocking " ++ show mb_err)
+                -- ToDo: this unhandled errror case seems bad
   where
     startCB :: Ptr a -> LPOVERLAPPED -> IO (Mgr.CbResult a1)
     startCB outBuf lpOverlapped = do



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0c68c409aacdd5db52fec96535033bd28fbd2215

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0c68c409aacdd5db52fec96535033bd28fbd2215
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241009/a8504ac6/attachment-0001.html>


More information about the ghc-commits mailing list