summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-07-24 01:36:13 +1000
committerJed Barber <jjbarber@y7mail.com>2014-07-24 01:36:13 +1000
commit7e9f4b138f8a5336bdb7eb1633547932f0d13da5 (patch)
tree5c4e38aa7bcaab4de039686d590c03a48050fe19
parent149f946fae07a0e874d5f054323f4305b8fa7028 (diff)
Ensured putc instruction will properly close file handles
-rw-r--r--src/Grasp/Interpreter.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Grasp/Interpreter.hs b/src/Grasp/Interpreter.hs
index 969c848..0ea7a57 100644
--- a/src/Grasp/Interpreter.hs
+++ b/src/Grasp/Interpreter.hs
@@ -3,6 +3,7 @@ module Grasp.Interpreter (
) where
+import Control.Monad
import System.Random
import System.IO
import Text.Read( readMaybe )
@@ -338,6 +339,7 @@ putcI g node = do
" may only have one file handle")
hPutChar fh c
+ when (fh /= stdout) (hClose fh)
return g