@@ -33,7 +33,7 @@ import System.Directory
3333import System.Environment
3434import System.Exit (ExitCode (..))
3535import System.FilePath
36−import System.IO (stdout, hClose)
36+import System.IO (stderr, hClose)
3737import System.IO.Temp (withSystemTempDirectory, withTempDirectory,
3838 withTempFile)
3939import qualified System.IO.Error as IE
@@ -312,9 +312,9 @@ runTectonic verbosity program args' tmpDir' source = do
312312 (pipeProcess (Just env) program programArgs sourceBL)
313313 (handlePDFProgramNotFound program)
314314 when (verbosity >= INFO) $ liftIO $ do
315− putStrLn "[makePDF] Running"
316− BL.hPutStr stdout out
317− putStr "\n"
315+ UTF8.hPutStrLn stderr "[makePDF] Running"
316+ BL.hPutStr stderr out
317+ UTF8.hPutStr stderr "\n"
318318 let pdfFile = tmpDir ++ "/texput.pdf"
319319 (_, pdf) <- getResultingPDF Nothing pdfFile
320320 return (exit, out, pdf)
@@ -378,9 +378,9 @@ runTeXProgram verbosity program args numRuns tmpDir' source = do
378378 (pipeProcess (Just env'') program programArgs BL.empty)
379379 (handlePDFProgramNotFound program)
380380 when (verbosity >= INFO) $ liftIO $ do
381− putStrLn $ "[makePDF] Run #" ++ show runNumber
382− BL.hPutStr stdout out
383− putStr "\n"
381+ UTF8.hPutStrLn stderr $ "[makePDF] Run #" ++ show runNumber
382+ BL.hPutStr stderr out
383+ UTF8.hPutStr stderr "\n"
384384 if runNumber < numRuns
385385 then runTeX (runNumber + 1)
386386 else do
@@ -432,8 +432,8 @@ html2pdf verbosity program args source =
432432 (pipeProcess (Just env') program programArgs BL.empty)
433433 (handlePDFProgramNotFound program)
434434 when (verbosity >= INFO) $ do
435− BL.hPutStr stdout out
436− putStr "\n"
435+ BL.hPutStr stderr out
436+ UTF8.hPutStr stderr "\n"
437437 pdfExists <- doesFileExist pdfFile
438438 mbPdf <- if pdfExists
439439 -- We read PDF as a strict bytestring to make sure that the
@@ -465,8 +465,8 @@ context2pdf verbosity program pdfargs tmpDir source =
465465 (pipeProcess (Just env') program programArgs BL.empty)
466466 (handlePDFProgramNotFound program)
467467 when (verbosity >= INFO) $ do
468− BL.hPutStr stdout out
469− putStr "\n"
468+ BL.hPutStr stderr out
469+ UTF8.hPutStr stderr "\n"
470470 let pdfFile = replaceExtension file ".pdf"
471471 pdfExists <- doesFileExist pdfFile
472472 mbPdf <- if pdfExists
@@ -492,17 +492,17 @@ showVerboseInfo :: Maybe FilePath
492492showVerboseInfo mbTmpDir program programArgs env source = do
493493 case mbTmpDir of
494494 Just tmpDir -> do
495− putStrLn "[makePDF] temp dir:"
496− putStrLn tmpDir
495+ UTF8.hPutStrLn stderr "[makePDF] temp dir:"
496+ UTF8.hPutStrLn stderr tmpDir
497497 Nothing -> return ()
498− putStrLn "[makePDF] Command line:"
499− putStrLn $ program ++ " " ++ unwords (map show programArgs)
500− putStr "\n"
501− putStrLn "[makePDF] Environment:"
502− mapM_ print env
503− putStr "\n"
504− putStrLn "[makePDF] Source:"
505− UTF8.putStrLn source
498+ UTF8.hPutStrLn stderr "[makePDF] Command line:"
499+ UTF8.hPutStrLn stderr $ program ++ " " ++ unwords (map show programArgs)
500+ UTF8.hPutStr stderr "\n"
501+ UTF8.hPutStrLn stderr "[makePDF] Environment:"
502+ mapM_ (UTF8.hPutStrLn stderr . show) env
503+ UTF8.hPutStr stderr "\n"
504+ UTF8.hPutStrLn stderr "[makePDF] Source:"
505+ UTF8.hPutStrLn stderr source
506506
507507handlePDFProgramNotFound :: String -> IE.IOError -> IO a
508508handlePDFProgramNotFound program e