aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-11-03 11:44:00 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2019-11-03 11:44:00 -0800
commite906e5ac23177c4377591c73c8e796e764096a32 (patch)
treeb8b868ea48514338f68f35648cf880a4d2a40035 /src/Text/Pandoc/App.hs
parentc4ff0b5564aab0fdf8f6fe0fcecb332615933f4b (diff)
downloadpandoc-e906e5ac23177c4377591c73c8e796e764096a32.tar.gz
Allow pdf output to stdout.
PDF output will not be output to the terminal, but can be sent to stdout using either `-o -` or a pipe. The intermediate format will be determined based on the setting of `--pdf-engine`. Closes #5751.
Diffstat (limited to 'src/Text/Pandoc/App.hs')
-rw-r--r--src/Text/Pandoc/App.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 0f379419c..db9d029ac 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -185,7 +185,8 @@ convertWithOpts opts = do
-- force this with '-o -'. On posix systems, we detect
-- when stdout is being piped and allow output to stdout
-- in that case, but on Windows we can't.
- when (not (isTextFormat format) && istty && isNothing ( optOutputFile opts)) $
+ when ((pdfOutput || not (isTextFormat format)) &&
+ istty && isNothing ( optOutputFile opts)) $
throwError $ PandocAppError $
"Cannot write " ++ format ++ " output to terminal.\n" ++
"Specify an output file using the -o option, or " ++