[Haskell-cafe] getChar

2008-03-25 Thread Cetin Sert
Hi, is there a version of getChar that doesn't buffer keyboard input until enter is pressed? specialReadln :: IO String specialReadln = do c ← getChar if c == '#' then do return [] else do cs ← specialReadln

Re: [Haskell-cafe] getChar

2008-03-25 Thread Albert Y. C. Lai
Cetin Sert wrote: is there a version of getChar that doesn't buffer keyboard input until enter is pressed? Look into hSetBuffering (module System.IO or IO). As a quick start: hSetBuffering stdin NoBuffering ___ Haskell-Cafe mailing list

[Haskell-cafe] getChar + System.Cmd.system + threads causes hangups

2006-02-20 Thread Einar Karttunen
Hello Using system or any variant of it from System.Process seems broken in multithreaded environments. This example will fail with and without -threaded. When run the program will print hello: start and then freeze. After pressing enter (the first getChar) System.Cmd.system will complete, but

Re: [Haskell-cafe] getChar + System.Cmd.system + threads causes hangups

2006-02-20 Thread Einar Karttunen
Here is a version that works fine: myRawSystem cmd args = do (inP, outP, errP, pid) - runInteractiveProcess cmd args Nothing Nothing hClose inP os - pGetContents outP es - pGetContents errP ec - waitForProcess pid case ec of ExitSuccess - return ()