git.iko.soy/typeable/pandoc
on master help sign in
Moved istty check.
30eda43John MacFarlane
src/Text/Pandoc/App.hs+5−5
@@ -122,6 +122,11 @@ convertWithOpts opts = do
122 CRLF -> IO.CRLF
122 CRLF -> IO.CRLF
123 LF -> IO.LF
123 LF -> IO.LF
124 Native -> nativeNewline
124 Native -> nativeNewline
125+#ifdef _WINDOWS
126+ let istty = True
127+#else
128+ istty <- liftIO $ queryTerminal stdOutput
129+#endif
125
130
126 runIO' $ do
131 runIO' $ do
127 setUserDataDir datadir
132 setUserDataDir datadir
@@ -178,11 +183,6 @@ convertWithOpts opts = do
178 -- force this with '-o -'. On posix systems, we detect
183 -- force this with '-o -'. On posix systems, we detect
179 -- when stdout is being piped and allow output to stdout
184 -- when stdout is being piped and allow output to stdout
180 -- in that case, but on Windows we can't.
185 -- in that case, but on Windows we can't.
181−#ifdef _WINDOWS
182− let istty = True
183−#else
184− istty <- liftIO $ queryTerminal stdOutput
185−#endif
186 when (not (isTextFormat format) && istty && isNothing ( optOutputFile opts)) $
186 when (not (isTextFormat format) && istty && isNothing ( optOutputFile opts)) $
187 throwError $ PandocAppError $
187 throwError $ PandocAppError $
188 "Cannot write " ++ format ++ " output to terminal.\n" ++
188 "Cannot write " ++ format ++ " output to terminal.\n" ++