aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-07-20 12:51:03 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-07-20 12:51:03 -0700
commit30eda43192f34c21562e225204cd2c633e908a89 (patch)
tree9f35f833264d82befcfdfb266b7b135a7c4b6f0d /src/Text/Pandoc
parent8643361d2e78c6be3acd894e4b0dedb90c2fff45 (diff)
downloadpandoc-30eda43192f34c21562e225204cd2c633e908a89.tar.gz
Moved istty check.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/App.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 92782742c..e6d1f9356 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -122,6 +122,11 @@ convertWithOpts opts = do
CRLF -> IO.CRLF
LF -> IO.LF
Native -> nativeNewline
+#ifdef _WINDOWS
+ let istty = True
+#else
+ istty <- liftIO $ queryTerminal stdOutput
+#endif
runIO' $ do
setUserDataDir datadir
@@ -178,11 +183,6 @@ 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.
-#ifdef _WINDOWS
- let istty = True
-#else
- istty <- liftIO $ queryTerminal stdOutput
-#endif
when (not (isTextFormat format) && istty && isNothing ( optOutputFile opts)) $
throwError $ PandocAppError $
"Cannot write " ++ format ++ " output to terminal.\n" ++