From b4ab2c414dcc719a2dc0c38b29c65624165ad1c7 Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 11 Jul 2005 10:25:43 +0000 Subject: [PATCH] [project @ 2005-07-11 10:25:43 by simonmar] mingw32: ignore isDoesNotExistError failure from GHC.ConsoleHandler.flushConsole Submitted-by: Brian Smith --- ghc/compiler/ghci/InteractiveUI.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index 174317e..7cd720c 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -199,9 +199,13 @@ interactiveUI session srcs maybe_expr = do #if defined(mingw32_HOST_OS) -- The win32 Console API mutates the first character of -- type-ahead when reading from it in a non-buffered manner. Work - -- around this by flushing the input buffer of type-ahead characters. - -- - GHC.ConsoleHandler.flushConsole stdin + -- around this by flushing the input buffer of type-ahead characters, + -- but only if stdin is available. + flushed <- IO.try (GHC.ConsoleHandler.flushConsole stdin) + case flushed of + Left err | isDoesNotExistError err -> return () + | otherwise -> ioError err + Right () -> return () #endif startGHCi (runGHCi srcs maybe_expr) GHCiState{ progname = "", -- 1.7.10.4