#2189: hSetBuffering stdin NoBuffering doesn't work on Windows
-----------------------------+----------------------------------------------
Reporter: FalconNL | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 7.6.1
Component: libraries/base | Version: 6.8.2
Resolution: | Keywords: hsetbuffering buffering buffer
Os: Windows | Architecture: x86
Failure: None/Unknown | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related:
-----------------------------+----------------------------------------------
Comment(by pcapriotti):
I've spent some time looking into this. To summarize the situation:
1. setting a console handle to unbuffered mode breaks ghci input with
cmd.exe and cygwin
2. unbuffered console input doesn't work properly with newline characters
when using the POSIX API
3. I tried the simple C program above, and it works fine, but ESC
characters (as in the original issue) are still not detected. Maybe the
ESC key has some special behavior? Ctrl+[ does send a '\ESC' character
with msys, but not with cmd.exe.
Possible solutions:
* The best solution still seems to be to rewrite the whole IO subsystem
using the Windows API. Is anyone working on this already, perhaps?
* Alternatively, it might be possible to replace calls to `read` and
`write` with `ReadFile` and `WriteFile` respectively. I think we need to
replace both to ensure that buffering still works. The problem with this
is that we need to carry around the windows handle, to avoid using
`_get_osfhandle` at every call to `read`.
I'm not sure if any of those solutions would address problem 1 above.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2189#comment:37>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs