From: Ian Lynagh Date: Sun, 13 Jan 2008 12:41:07 +0000 (+0000) Subject: Only initialise readline if we are connected to a terminal X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=b25d67d4c0398dbceca0165c3b43df0625e1e06a Only initialise readline if we are connected to a terminal Patch from Bertram Felgenhauer --- diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index e4439d6..e712e9d 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