From 5c4377102f442208d844a3d42aa23a0d074b7257 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 3 Feb 2016 18:23:10 +0100 Subject: Fixed tex \end fuckup --- src/Tex.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Tex.hs') diff --git a/src/Tex.hs b/src/Tex.hs index a247218..5d347b9 100644 --- a/src/Tex.hs +++ b/src/Tex.hs @@ -2,10 +2,10 @@ module Tex ( compileTex ) where -import System.IO (stdout, stderr, hPutStrLn, writeFile, readFile) -import System.IO.Temp (withSystemTempDirectory) +import System.IO (stdout, stderr, hPutStrLn, writeFile, readFile, hClose) +import System.IO.Temp (withSystemTempDirectory, openTempFile) import System.Process (callProcess, readProcessWithExitCode) -import System.Directory (copyFile, getCurrentDirectory, setCurrentDirectory) +import System.Directory (copyFile, getCurrentDirectory, setCurrentDirectory, getTemporaryDirectory) import System.FilePath (takeFileName, FilePath(..), ()) import System.Exit (ExitCode(..)) @@ -50,6 +50,10 @@ compileTex' input tmpDir = do when (exitCode /= ExitSuccess) $ do hPutStrLn stdout out hPutStrLn stderr err + (srcF, srcH) <- flip openTempFile "source.tex" =<< getTemporaryDirectory + hPutStrLn srcH input + hClose srcH + hPutStrLn stdout $ "Tex source saved to " ++ srcF throwIO exitCode (\x -> return $!! (x, extractAlignment err)) =<< (readFile $ tmpDir "image.svg") where -- cgit v1.2.3