hLookAhead + hSetBuffering = unsupported operation (Illegal seek)
If you compile and run this program, and then press 'a' while it is running:
module Main (main) where
import System.IO
main :: IO ()
main = do hSetBuffering stdin NoBuffering
hLookAhead stdin >>= print
hSetBuffering stdin LineBuffering
then you get (amd64/Linux):
$ ./y
a'a'
y: <stdin>: hSetBuffering: unsupported operation (Illegal seek)
The docs at http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html#v%3AhSetBuffering say what happens when setting a buffer to !NoBuffering, but don't give any clue that this can happen when changing to !LineBuffering. I don't know if it is the behaviour or the docs that should be changed.
Also happens in the 6.10 branch.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.8.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |