hWaitForInput: don't try to read from the device (#4078)
[ghc-base.git] / GHC / IO / Handle / Text.hs
index 39482bc..23b9cdd 100644 (file)
@@ -95,7 +95,7 @@ hWaitForInput h msecs = do
                 return True
         else do
                -- there might be bytes in the byte buffer waiting to be decoded
-               cbuf' <- readTextDeviceNonBlocking handle_ cbuf
+               cbuf' <- decodeByteBuf handle_ cbuf
                writeIORef haCharBuffer cbuf'
 
                if not (isEmptyBuffer cbuf') then return True else do
@@ -911,8 +911,8 @@ hGetBufSome h ptr count
               bufReadNBEmpty h_ buf (castPtr ptr) 0 count
 
 haFD :: Handle__ -> FD
-haFD h_@Handle__{} = 
-   case cast h_ of
+haFD h_@Handle__{..} =
+   case cast haDevice of
              Nothing -> error "not an FD"
              Just fd -> fd