[Haskell-cafe] ptys and hGetContent problem

2010-03-08 Thread Mathijs Kwik
Hi all, I found this blogpost from Bryan O'Sullivan http://www.serpentine.com/blog/2008/09/30/unix-hacking-in-haskell-better-pseudoterminal-support/ and I wanted to try it out. Before moving to an interactive command (which needs pty), I just did a small test for ls -l / to see if it worked. I

Re: [Haskell-cafe] ptys and hGetContent problem

2010-03-08 Thread Ivan Lazar Miljenovic
And further... If I do want to use an interactive program which needs input, how do I send ctrl-d or ctrl-c? tail -f needs ctrl-c (or I need to kill the process) You want Ctrl-d in Unix-based OSs and Ctrl-z in Windows: http://en.wikipedia.org/wiki/End_of_File . Ctrl-c kills a program. --

Re: [Haskell-cafe] ptys and hGetContent problem

2010-03-08 Thread Nick Bowler
On 20:38 Mon 08 Mar , Mathijs Kwik wrote: Hi all, I found this blogpost from Bryan O'Sullivan http://www.serpentine.com/blog/2008/09/30/unix-hacking-in-haskell-better-pseudoterminal-support/ and I wanted to try it out. Before moving to an interactive command (which needs pty), I just

Re: [Haskell-cafe] ptys and hGetContent problem

2010-03-08 Thread Richard O'Keefe
On Mar 9, 2010, at 9:35 AM, Ivan Lazar Miljenovic wrote: And further... If I do want to use an interactive program which needs input, how do I send ctrl-d or ctrl-c? tail -f needs ctrl-c (or I need to kill the process) You want Ctrl-d in Unix-based OSs and Ctrl-z in Windows:

Re: [Haskell-cafe] ptys and hGetContent problem

2010-03-08 Thread Mathijs Kwik
Ok, cool I got a bit further now. I'm not using handles anymore (they seem to break indeed for ptys). Just using executePseudoTerminalFd now (from the original blogpost) and fdRead/fdWrite. Now I can communicate with the process and all goes well. If I really want lazy-like behaviour, I can just

Re: [Haskell-cafe] ptys and hGetContent problem

2010-03-08 Thread Mathijs Kwik
And to reply to myself again... ta - getTerminalAttributes fd setTerminalAttributes fd (withoutMode ta EnableEcho) Immediately -- and to find the right EOF character: let Just eofChar = controlChar ta EndOfFile On Tue, Mar 9, 2010 at 12:23 AM, Mathijs Kwik bluescreen...@gmail.com wrote: