diff options
author | Ian Lynagh <igloo@earth.li> | 2008-01-13 12:41:07 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2008-01-13 12:41:07 +0000 |
commit | b25d67d4c0398dbceca0165c3b43df0625e1e06a (patch) | |
tree | d9b8947c76ce2ab5441fbb70a1e9940f81e90a6a | |
parent | b9c0562f716770bc09573c5aa892ea0b76570a74 (diff) | |
download | haskell-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.hs | 16 |
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 |