diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-03 18:23:10 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-03 18:23:10 +0100 |
commit | 5c4377102f442208d844a3d42aa23a0d074b7257 (patch) | |
tree | f2e6441d5858154a82c63f6daf0febf00345a3b0 /src/Tex.hs | |
parent | 9d3ff4605d30b434cdc0f302bb565606f1bcf722 (diff) | |
download | dirty-haskell.org-5c4377102f442208d844a3d42aa23a0d074b7257.tar dirty-haskell.org-5c4377102f442208d844a3d42aa23a0d074b7257.tar.gz dirty-haskell.org-5c4377102f442208d844a3d42aa23a0d074b7257.tar.bz2 dirty-haskell.org-5c4377102f442208d844a3d42aa23a0d074b7257.tar.xz dirty-haskell.org-5c4377102f442208d844a3d42aa23a0d074b7257.zip |
Fixed tex \end fuckup
Diffstat (limited to 'src/Tex.hs')
-rw-r--r-- | src/Tex.hs | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -2,10 +2,10 @@ module Tex | |||
2 | ( compileTex | 2 | ( compileTex |
3 | ) where | 3 | ) where |
4 | 4 | ||
5 | import System.IO (stdout, stderr, hPutStrLn, writeFile, readFile) | 5 | import System.IO (stdout, stderr, hPutStrLn, writeFile, readFile, hClose) |
6 | import System.IO.Temp (withSystemTempDirectory) | 6 | import System.IO.Temp (withSystemTempDirectory, openTempFile) |
7 | import System.Process (callProcess, readProcessWithExitCode) | 7 | import System.Process (callProcess, readProcessWithExitCode) |
8 | import System.Directory (copyFile, getCurrentDirectory, setCurrentDirectory) | 8 | import System.Directory (copyFile, getCurrentDirectory, setCurrentDirectory, getTemporaryDirectory) |
9 | import System.FilePath (takeFileName, FilePath(..), (</>)) | 9 | import System.FilePath (takeFileName, FilePath(..), (</>)) |
10 | import System.Exit (ExitCode(..)) | 10 | import 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 |