summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2008-01-13 12:41:07 +0000
committerIan Lynagh <igloo@earth.li>2008-01-13 12:41:07 +0000
commitb25d67d4c0398dbceca0165c3b43df0625e1e06a (patch)
treed9b8947c76ce2ab5441fbb70a1e9940f81e90a6a
parentb9c0562f716770bc09573c5aa892ea0b76570a74 (diff)
downloadhaskell-b25d67d4c0398dbceca0165c3b43df0625e1e06a.tar.gz
Only initialise readline if we are connected to a terminal
Patch from Bertram Felgenhauer <int-e@gmx.de>
-rw-r--r--compiler/ghci/InteractiveUI.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs
index e4439d6543..e712e9dfd8 100644
--- a/compiler/ghci/InteractiveUI.hs
+++ b/compiler/ghci/InteractiveUI.hs
@@ -299,13 +299,15 @@ interactiveUI session srcs maybe_expr = do
hSetBuffering stdin NoBuffering
#ifdef USE_READLINE
- Readline.initialize
- Readline.setAttemptedCompletionFunction (Just completeWord)
- --Readline.parseAndBind "set show-all-if-ambiguous 1"
-
- Readline.setBasicWordBreakCharacters word_break_chars
- Readline.setCompleterWordBreakCharacters word_break_chars
- Readline.setCompletionAppendCharacter Nothing
+ is_tty <- hIsTerminalDevice stdin
+ when is_tty $ do
+ Readline.initialize
+ Readline.setAttemptedCompletionFunction (Just completeWord)
+ --Readline.parseAndBind "set show-all-if-ambiguous 1"
+
+ Readline.setBasicWordBreakCharacters word_break_chars
+ Readline.setCompleterWordBreakCharacters word_break_chars
+ Readline.setCompletionAppendCharacter Nothing
#endif
-- initial context is just the Prelude