@@ -265,7 +265,9 @@ execApp env ctxt (EP _ fp _) (_:fn:fileStr:modeStr:rest)
265265 "r+" -> Right ReadWriteMode
266266 _ -> Left ("Invalid mode for " ++ f ++ ": " ++ mode)
267267 case fmap (openFile f) m of
268− Right h -> do h' <- h; return $ Right (ioWrap (EHandle h'), tail rest)
268+ Right h -> do h' <- h
269+ hSetBinaryMode h' True
270+ return $ Right (ioWrap (EHandle h'), tail rest)
269271 Left err -> return $ Left err)
270272 (\e -> let _ = ( e::SomeException)
271273 in return $ Right (ioWrap (EPtr nullPtr), tail rest))