From d7ae87b35a8835d60dd0b23a0365e7d938c1665b Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 18 Dec 2014 10:43:19 +1100 Subject: getc line buffering bug fixed --- src/Grasp/Interpreter.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Grasp/Interpreter.hs b/src/Grasp/Interpreter.hs index 1203da2..14de9bc 100644 --- a/src/Grasp/Interpreter.hs +++ b/src/Grasp/Interpreter.hs @@ -407,7 +407,9 @@ getcI = do Monad.when (length fhNodes > 1) (error "Instruction getc should have at most one fh argument") let fh = IN.toString . GN.toInst $ head fhNodes - handle <- if (length fhNodes == 0) then return IO.stdin else GMonad.getReadHandle fh + handle <- if (length fhNodes == 0) + then liftIO (IO.hSetBuffering IO.stdin IO.NoBuffering) >> return IO.stdin + else GMonad.getReadHandle fh c <- liftIO (IO.hGetChar handle) let result = if (c == '\EOT') then -1 else Char.ord c -- cgit