summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-12-18 10:43:19 +1100
committerJed Barber <jjbarber@y7mail.com>2014-12-18 10:43:19 +1100
commitd7ae87b35a8835d60dd0b23a0365e7d938c1665b (patch)
tree41e6bf96542f874db7d0e9f4165bee66e0f2e0cc
parent347eebc55a1de42429b38b67c355a48a358ead63 (diff)
getc line buffering bug fixed
-rw-r--r--src/Grasp/Interpreter.hs4
1 files changed, 3 insertions, 1 deletions
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