summaryrefslogtreecommitdiff
path: root/src/Tex.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Tex.hs')
-rw-r--r--src/Tex.hs10
1 files changed, 7 insertions, 3 deletions
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
2 ( compileTex 2 ( compileTex
3 ) where 3 ) where
4 4
5import System.IO (stdout, stderr, hPutStrLn, writeFile, readFile) 5import System.IO (stdout, stderr, hPutStrLn, writeFile, readFile, hClose)
6import System.IO.Temp (withSystemTempDirectory) 6import System.IO.Temp (withSystemTempDirectory, openTempFile)
7import System.Process (callProcess, readProcessWithExitCode) 7import System.Process (callProcess, readProcessWithExitCode)
8import System.Directory (copyFile, getCurrentDirectory, setCurrentDirectory) 8import System.Directory (copyFile, getCurrentDirectory, setCurrentDirectory, getTemporaryDirectory)
9import System.FilePath (takeFileName, FilePath(..), (</>)) 9import System.FilePath (takeFileName, FilePath(..), (</>))
10import System.Exit (ExitCode(..)) 10import System.Exit (ExitCode(..))
11 11
@@ -50,6 +50,10 @@ compileTex' input tmpDir = do
50 when (exitCode /= ExitSuccess) $ do 50 when (exitCode /= ExitSuccess) $ do
51 hPutStrLn stdout out 51 hPutStrLn stdout out
52 hPutStrLn stderr err 52 hPutStrLn stderr err
53 (srcF, srcH) <- flip openTempFile "source.tex" =<< getTemporaryDirectory
54 hPutStrLn srcH input
55 hClose srcH
56 hPutStrLn stdout $ "Tex source saved to " ++ srcF
53 throwIO exitCode 57 throwIO exitCode
54 (\x -> return $!! (x, extractAlignment err)) =<< (readFile $ tmpDir </> "image.svg") 58 (\x -> return $!! (x, extractAlignment err)) =<< (readFile $ tmpDir </> "image.svg")
55 where 59 where