Are you adjusting 'System.IO.hSetBuffering' to NoBuffering for those handles?


Graham Fawcett wrote:
Hi folks,

I would like to communicate with an external, line-oriented process,
which takes a sequence of one-line commands, each returning an
arbitrary number of lines, and waits for another command after each
response.  So, something like:

sendCmd :: (Handle, Handle) -> String -> IO [String]
...

main = do
  handles <- connectToExternalProcess
  sendCmd handles "do something"
  resp <- sendCmd "get results" -- needs strict I/O, before "quit"?
  sendCmd "quit"
  mapM_ putStrLn resp

I've tried using runInteractiveCommand, and several combinations of
hFlush, hWaitForInput, etc., but I can't find a combination that
actually works.

I know this is a sketchy description, but can anyone offer some sample
code, or point me toward a program that has similar behaviour?

Thanks,
Graham

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to