summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorPaolo Capriotti <p.capriotti@gmail.com>2012-04-19 13:28:47 +0100
committerPaolo Capriotti <p.capriotti@gmail.com>2012-04-23 15:36:20 +0100
commit739a009be27e96384e73ec63c309ac642cb0ef79 (patch)
treed46a18192c280e582357e6d769603166edd0c459 /ghc
parentb35e7e21ae12c5e142c10236b1cee49fcaea9e88 (diff)
downloadhaskell-739a009be27e96384e73ec63c309ac642cb0ef79.tar.gz
ghci: write exceptions to stderr (#5980)
Diffstat (limited to 'ghc')
-rw-r--r--ghc/InteractiveUI.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 8d6e23c678..75e8ca0f67 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -2837,14 +2837,16 @@ showException :: SomeException -> GHCi ()
showException se =
liftIO $ case fromException se of
-- omit the location for CmdLineError:
- Just (CmdLineError s) -> putStrLn s
+ Just (CmdLineError s) -> putException s
-- ditto:
- Just ph@(PhaseFailed {}) -> putStrLn (showGhcException ph "")
- Just other_ghc_ex -> print other_ghc_ex
+ Just ph@(PhaseFailed {}) -> putException (showGhcException ph "")
+ Just other_ghc_ex -> putException (show other_ghc_ex)
Nothing ->
case fromException se of
- Just UserInterrupt -> putStrLn "Interrupted."
- _ -> putStrLn ("*** Exception: " ++ show se)
+ Just UserInterrupt -> putException "Interrupted."
+ _ -> putException ("*** Exception: " ++ show se)
+ where
+ putException = hPutStrLn stderr
-----------------------------------------------------------------------------