From 7e9f4b138f8a5336bdb7eb1633547932f0d13da5 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 24 Jul 2014 01:36:13 +1000 Subject: Ensured putc instruction will properly close file handles --- src/Grasp/Interpreter.hs | 2 ++ 1 file changed, 2 insertions(+) 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 -- cgit