From 1e215b361470a13574e5bb341d1910871416a248 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 14 Jan 2009 13:46:12 +0000 Subject: [PATCH] #2699: exit silently for EPIPE on stdout --- GHC/TopHandler.lhs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/GHC/TopHandler.lhs b/GHC/TopHandler.lhs index dffba02..6a2520a 100644 --- a/GHC/TopHandler.lhs +++ b/GHC/TopHandler.lhs @@ -168,8 +168,14 @@ real_handler exit se@(SomeException exn) = Just ExitSuccess -> exit 0 Just (ExitFailure n) -> exit n - _ -> do reportError se - exit 1 + -- EPIPE errors received for stdout are ignored (#2699) + _ -> case cast exn of + Just IOError{ ioe_type = ResourceVanished, + ioe_errno = Just ioe, + ioe_handle = Just hdl } + | Errno ioe == ePIPE, hdl == stdout -> exit 0 + _ -> do reportError se + exit 1 -- try to flush stdout/stderr, but don't worry if we fail -- 1.7.10.4