
I expect the following to work, but it doesn't. Can someone help: 9:53am moussor:JavaInterp/ cat > Test.hs import System.IO main = do hSetBuffering stdout NoBuffering hSetBuffering stdin NoBuffering loop where loop = do putStr "> " s <- getLine putStrLn $ "You said: " ++ s loop 9:54am moussor:JavaInterp/ ghc Test.hs -o test 9:54am moussor:JavaInterp/ ./test
hello foYou said: hello o^Ctest: interrupted 9:54am moussor:JavaInterp/ ./test hello foYou said: hello o
You said: foo
You said: You said: ^Ctest: interrupted 9:55am moussor:JavaInterp/
basically, i have to type 'fo' before it will give me my first reply. I thought the two calls to hSetBuffering would fix this. -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume

Not for me, GHC 5.04.2 (Solaris). Nor with the GHC from CVS: 10:13am moussor:JavaInterp/ ~/nlg/ghc-cvs/ghc/compiler/ghc-inplace Test.hs -o test 150.50u 1.77s 2:48.29 90.4% 10:16am moussor:JavaInterp/ ./test
foo^H^H^Ctest: interrupted 10:16am moussor:JavaInterp/ ./test foo You said: foo hello
bYou said: hello
You said: ar
here it goes right the first time, but then i have to type two more letters (in this case 'b\n') to get it to respond to "hello". -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On Wed, 5 Feb 2003, Ferenc Wagner wrote:
Hal Daume III
writes: I expect the following to work, but it doesn't.
Yes it does. :-) Even without the hSetBuffering lines. GHC 5.04-1 Feri. _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Hal Daume III
Not for me, GHC 5.04.2 (Solaris).
here it goes right the first time, but then i have to type two more letters (in this case 'b\n') to get it to respond to "hello".
Solaris has a slightly bizarre buffering scheme in "raw" terminal mode, whereby it buffers 4 characters at a time, instead of passing on each character immediately. Try stty -icanon min 1 (or something similar) to fix it? Regards, Malcolm

Malcolm Wallace wrote:
Hal Daume III
writes: Not for me, GHC 5.04.2 (Solaris).
here it goes right the first time, but then i have to type two more letters (in this case 'b\n') to get it to respond to "hello".
Solaris has a slightly bizarre buffering scheme in "raw" terminal mode, whereby it buffers 4 characters at a time, instead of passing on each character immediately. Try
stty -icanon min 1
(or something similar) to fix it?
Someone must have failed setting the tty mode. :-) The 4 is (if I remember right) the VMIN value which is stored in the same place as the EOF (^D = 4) character. It has to be set to 0 when placing the tty in raw mode. -- Lennart
participants (4)
-
Ferenc Wagner
-
Hal Daume III
-
Lennart Augustsson
-
Malcolm Wallace