X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FPanic.lhs;h=e11b28faefe5078bf77752c8cb446c82833a72bc;hb=5a185e27def3ee8ace1704235eb277bc60c38618;hp=0833de87ecb2c1e93197f1e3b5df3916e6b5492f;hpb=9e7567632bc6af06d3e874d1675479e7b1991f63;p=ghc-hetmet.git diff --git a/compiler/utils/Panic.lhs b/compiler/utils/Panic.lhs index 0833de8..e11b28f 100644 --- a/compiler/utils/Panic.lhs +++ b/compiler/utils/Panic.lhs @@ -63,7 +63,6 @@ ghcError e = Exception.throw e data GhcException = PhaseFailed String -- name of phase ExitCode -- an external phase (eg. cpp) failed - | Interrupted -- someone pressed ^C | Signal Int -- some other fatal signal (SIGHUP,SIGTERM) | UsageError String -- prints the short usage msg after the error | CmdLineError String -- cmdline prob, but doesn't print usage @@ -107,8 +106,6 @@ showGhcException (ProgramError str) = showString str showGhcException (InstallationError str) = showString str -showGhcException (Interrupted) - = showString "interrupted" showGhcException (Signal n) = showString "signal: " . shows n showGhcException (Panic s) @@ -151,7 +148,7 @@ assertPanic file line = \end{code} \begin{code} --- | tryMost is like try, but passes through Interrupted and Panic +-- | tryMost is like try, but passes through UserInterrupt and Panic -- exceptions. Used when we want soft failures when reading interface -- files, for example. @@ -162,7 +159,6 @@ tryMost action = do r <- try action Left se -> case fromException se of -- Some GhcException's we rethrow, - Just Interrupted -> throwIO se Just (Signal _) -> throwIO se Just (Panic _) -> throwIO se -- others we return @@ -189,7 +185,7 @@ installSignalHandlers = do modifyMVar_ interruptTargetThread (return . (main_thread :)) let - interrupt_exn = (toException Interrupted) + interrupt_exn = (toException UserInterrupt) interrupt = do withMVar interruptTargetThread $ \targets -> @@ -197,14 +193,13 @@ installSignalHandlers = do [] -> return () (thread:_) -> throwTo thread interrupt_exn - fatal_signal n = throwTo main_thread (Signal (fromIntegral n)) - -- #if !defined(mingw32_HOST_OS) _ <- installHandler sigQUIT (Catch interrupt) Nothing _ <- installHandler sigINT (Catch interrupt) Nothing -- see #3656; in the future we should install these automatically for -- all Haskell programs in the same way that we install a ^C handler. + let fatal_signal n = throwTo main_thread (Signal (fromIntegral n)) _ <- installHandler sigHUP (Catch (fatal_signal sigHUP)) Nothing _ <- installHandler sigTERM (Catch (fatal_signal sigTERM)) Nothing return ()