
23 Apr
2013
23 Apr
'13
2:28 a.m.
quoth Evan Laforge
and it still waits for the subprocess to complete. Actually, it looks like it's the client's hGetContents, since hGetChar comes back immediately. I guess that's understandable, but even hGetLine blocks.
In the version I was looking at, if I change the server's output {-- IO.hPutStr hdl "response" --} to "response\n", it works. Otherwise hGetLine will still be polling for the newline that will never come.
System.IO doesn't seem to have a hRead :: Int -> IO String, I guess you have to go down to the POSIX fd level, or read char-by-char.
In the present case I believe we'd be talking about Network.Socket.ByteString.recv. With a POSIX device like a pipe, then System.Posix.IO.fdRead. Donn