From: simonmar Date: Mon, 11 Jul 2005 10:25:43 +0000 (+0000) Subject: [project @ 2005-07-11 10:25:43 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~383 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b4ab2c414dcc719a2dc0c38b29c65624165ad1c7;p=ghc-hetmet.git [project @ 2005-07-11 10:25:43 by simonmar] mingw32: ignore isDoesNotExistError failure from GHC.ConsoleHandler.flushConsole Submitted-by: Brian Smith --- 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 = "",