Errors reading stdin on Windows
Hi,
I'm running GHC 7.10.2 on Windows 7 x64. Given this code that reads bytes of stdin
:
import Foreign.C
import Foreign
import System.Posix.Internals
import qualified GHC.IO.FD as FD
readStdin bytes = allocaBytes bytes $ \p ->
throwErrnoIfMinus1 "" $ c_safe_read (FD.fdFD FD.stdin) p (fromIntegral bytes)
Running
readStdin (32 * 1024)
Throws the following
*** Exception: resource exhausted (Not enough space)
Taking less bytes, e.g. readStdin (30 * 1024)
, runs as expected.
This code is motivated by this issue in the bytestring
library. This is essentially a minimization of the error case here.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |