aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-01-21 14:18:36 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-01-21 14:18:36 -0800
commite6e4311ddd3f964122a309af926dc95f6ef970d9 (patch)
tree372293706afe60e9b7e5c0e89f7e9bda725009b3 /src/Text/Pandoc
parent194bdadc57fffc698aedfd43c0cb2aa09e3a75ea (diff)
downloadpandoc-e6e4311ddd3f964122a309af926dc95f6ef970d9.tar.gz
pandoc: Better error checking.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/PDF.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index b3d0fcbb8..85689fa9b 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -72,9 +72,9 @@ extractMsg log' = do
let msg' = dropWhile (not . ("!" `BC.isPrefixOf`)) $ BC.lines log'
let (msg'',rest) = break ("l." `BC.isPrefixOf`) msg'
let lineno = take 1 rest
- if not (null msg')
- then BC.unlines (msg'' ++ lineno)
- else "Unknown errorR"
+ if null msg'
+ then log'
+ else BC.unlines (msg'' ++ lineno)
parseLine :: ByteString -> Bool
parseLine ln =
@@ -101,7 +101,7 @@ runTeXProgram program runsLeft tmpDir source = do
hClose h
let programArgs = ["-halt-on-error", "-interaction", "nonstopmode",
"-output-directory", tmpDir, file]
- (exit, out, _err) <- readCommand program programArgs
+ (exit, out, err) <- readCommand program programArgs
removeFile file
let pdfFile = replaceDirectory (replaceExtension file ".pdf") tmpDir
pdfExists <- doesFileExist pdfFile
@@ -110,7 +110,7 @@ runTeXProgram program runsLeft tmpDir source = do
else return Nothing
if hasUndefinedRefs out && runsLeft > 0
then runTeXProgram program (runsLeft - 1) tmpDir source
- else return (exit, out, pdf)
+ else return (exit, out <> err, pdf)
-- utility functions