Ticket #1189: patch-InteractiveUI.hs

File patch-InteractiveUI.hs, 1.4 KB (added by adam@…, 21 years ago)

patch-InteractiveUI.hs

Line 
1--- ghc/compiler/ghci/InteractiveUI.hs.sav      Mon Jul 21 10:52:28 2003
2+++ ghc/compiler/ghci/InteractiveUI.hs  Tue Aug 26 12:57:29 2003
3@@ -229,32 +229,28 @@
4        loadModule paths
5 
6   -- enter the interactive loop
7-#if defined(mingw32_HOST_OS)
8-   -- Always show prompt, since hIsTerminalDevice returns True for Consoles
9-   -- only, which we may or may not be running under (cf. Emacs sub-shells.)
10-  interactiveLoop True
11-#else
12+  -- if verbosity is greater than 0, display the prompt.
13+  let show_prompt = verbosity dflags > 0
14   is_tty <- io (hIsTerminalDevice stdin)
15-  interactiveLoop is_tty
16-#endif
17+  interactiveLoop is_tty show_prompt
18 
19   -- and finally, exit
20-  io $ do when (verbosity dflags > 0) $ putStrLn "Leaving GHCi."
21+  io $ do when (show_prompt) $ putStrLn "Leaving GHCi."
22 
23 
24-interactiveLoop is_tty = do
25+interactiveLoop is_tty show_prompt = do
26   -- Ignore ^C exceptions caught here
27   ghciHandleDyn (\e -> case e of 
28-                       Interrupted -> ghciUnblock (interactiveLoop is_tty)
29+                       Interrupted -> ghciUnblock (interactiveLoop is_tty show_prompt)
30                        _other      -> return ()) $ do
31 
32   -- read commands from stdin
33 #if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS
34   if (is_tty) 
35        then readlineLoop
36-       else fileLoop stdin False  -- turn off prompt for non-TTY input
37+       else fileLoop stdin show_prompt
38 #else
39-  fileLoop stdin is_tty
40+  fileLoop stdin show_prompt
41 #endif
42 
43