Skip to content

Commit 9401b56

Browse files
No bug report on UserInterrupt (#2000)
* No bug report on UserInterrupt * Rebuild * Update kore/src/Kore/BugReport.hs Co-authored-by: Thomas Tuegel <ttuegel@mailbox.org> * Rebuild Co-authored-by: Thomas Tuegel <ttuegel@mailbox.org>
1 parent b1d73c0 commit 9401b56

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

kore/src/Kore/BugReport.hs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import Prelude.Kore
1616

1717
import qualified Codec.Archive.Tar as Tar
1818
import qualified Codec.Compression.GZip as GZip
19+
import Control.Exception
20+
( AsyncException (UserInterrupt)
21+
, fromException
22+
)
1923
import Control.Monad.Catch
2024
( ExitCase (..)
2125
, displayException
@@ -79,7 +83,7 @@ writeBugReportArchive base tar = do
7983
{- | Run the inner action with a temporary directory holding the bug report.
8084
8185
The bug report will be saved as an archive if that was requested by the user, or
82-
if there is an error in the inner action.
86+
if there is an error in the inner action other than 'UserInterrupt'.
8387
8488
-}
8589
withBugReport
@@ -104,10 +108,13 @@ withBugReport exeName bugReport act =
104108
releaseTempDirectory tmpDir exitCase = do
105109
case exitCase of
106110
ExitCaseSuccess _ -> optionalWriteBugReport tmpDir
107-
ExitCaseException someException -> do
108-
let message = displayException someException
109-
writeFile (tmpDir </> "error" <.> "log") message
110-
alwaysWriteBugReport tmpDir
111+
ExitCaseException someException
112+
| Just UserInterrupt == fromException someException ->
113+
optionalWriteBugReport tmpDir
114+
| otherwise -> do
115+
let message = displayException someException
116+
writeFile (tmpDir </> "error" <.> "log") message
117+
alwaysWriteBugReport tmpDir
111118
ExitCaseAbort -> alwaysWriteBugReport tmpDir
112119
removePathForcibly tmpDir
113120
alwaysWriteBugReport tmpDir =

0 commit comments

Comments
 (0)