File tree Expand file tree Collapse file tree 5 files changed +19
-10
lines changed
Expand file tree Collapse file tree 5 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ import qualified Data.Text as Text
3434 , split
3535 )
3636import qualified Data.Text.IO as Text
37- ( putStrLn
37+ ( hPutStrLn
3838 , readFile
3939 )
4040import qualified GHC.Generics as GHC
@@ -80,6 +80,7 @@ import System.FilePath
8080 )
8181import System.IO
8282 ( IOMode (WriteMode )
83+ , stderr
8384 , withFile
8485 )
8586
@@ -804,7 +805,7 @@ koreMerge execOptions mergeOptions = do
804805 Nothing -> mergeAllRules mainModule ruleIds
805806 case eitherMergedRule of
806807 (Left err) -> do
807- lift $ Text. putStrLn err
808+ lift $ Text. hPutStrLn stderr err
808809 return (ExitFailure 1 )
809810 (Right mergedRule) -> do
810811 let mergedRule' =
Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ import System.Clock
6363 )
6464
6565import GlobalMain
66+ import System.IO
67+ ( hPutStrLn
68+ , stderr
69+ )
6670
6771-- | Represents a file name along with its module name passed.
6872data KoreModule = KoreModule
@@ -213,7 +217,7 @@ mainWithOptions
213217 && isNothing (unReplScript replScript)
214218 )
215219 $ lift $ do
216- putStrLn
220+ hPutStrLn stderr
217221 " You must supply the path to the repl script\
218222 \ in order to run the repl in run-script mode."
219223 exitFailure
@@ -223,7 +227,7 @@ mainWithOptions
223227 && scriptModeOutput == EnableOutput
224228 )
225229 $ lift $ do
226- putStrLn
230+ hPutStrLn stderr
227231 " The --save-run-output flag is only available\
228232 \ when running the repl in run-script mode."
229233 exitFailure
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ withBugReport exeName bugReportOption act =
146146 optionalWriteBugReport tmpDir
147147 | Just (ioe :: IOException ) <- fromException someException
148148 , NoSuchThing <- ioe_type ioe -> do
149- putStrLn $ displayException someException
149+ hPutStrLn stderr $ displayException someException
150150 optionalWriteBugReport tmpDir
151151 | otherwise -> do
152152 let message = displayException someException
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ import Kore.Attribute.RuleIndex
5454import qualified Kore.Attribute.RuleIndex as Attribute
5555import System.IO
5656 ( hFlush
57+ , hPutStrLn
58+ , stderr
5759 , stdout
5860 )
5961import Text.Megaparsec
@@ -274,7 +276,7 @@ runRepl
274276 catchInterruptWithDefault a =
275277 Exception. handle $ \ case
276278 UserInterrupt -> do
277- liftIO $ putStrLn " Step evaluation interrupted."
279+ liftIO $ hPutStrLn stderr " Step evaluation interrupted."
278280 pure a
279281 e -> Exception. throwM e
280282
Original file line number Diff line number Diff line change @@ -132,6 +132,8 @@ import System.FilePath
132132 )
133133import System.IO
134134 ( IOMode (.. )
135+ , hPutStrLn
136+ , stderr
135137 , withFile
136138 )
137139import System.Process
@@ -1191,7 +1193,7 @@ pipe cmd file args = do
11911193 outputFunc str
11921194 case maybeOutput of
11931195 Nothing ->
1194- putStrLn " Error: couldn't access output handle."
1196+ hPutStrLn stderr " Error: couldn't access output handle."
11951197 Just handle -> do
11961198 output <- liftIO $ hGetContents handle
11971199 modifyIORef pipeOut (appReplOut . AuxOut $ output)
@@ -1517,11 +1519,11 @@ parseEvalScript file scriptModeOutput = do
15171519 contents <- lift . liftIO $ readFile file
15181520 let result = runParser scriptParser file (Text. pack contents)
15191521 either parseFailed executeScript result
1520- else lift . liftIO . putStrLn $ " Cannot find " <> file
1522+ else lift . liftIO . hPutStrLn stderr $ " Cannot find " <> file
15211523
15221524 where
15231525 parseFailed err =
1524- lift . liftIO . putStrLn
1526+ lift . liftIO . hPutStrLn stderr
15251527 $ " \n Couldn't parse repl script file."
15261528 <> " \n Parser error at: "
15271529 <> (err & toReplScriptParseErrors & errorBundlePretty)
@@ -1619,4 +1621,4 @@ withExistingDirectory path action =
16191621 ifM
16201622 (doesParentDirectoryExist path)
16211623 (action path)
1622- $ liftIO . putStrLn $ " Directory does not exist."
1624+ $ liftIO . hPutStrLn stderr $ " Directory does not exist."
You can’t perform that action at this time.
0 commit comments