commercialhaskell / commercialhaskell/stack

stack test fails to run clean up actions on SIGINT

Open
#6,236 3 comments 0 reactions 0 assignees View on GitHub
component: testing resolution: upstream issue
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments (optional)

Copied from https://github.com/UnkindPartition/tasty/issues/354

### Steps to reproduce

```
-- foo.cabal
cabal-version: 3.0
name: foo
version: 0
build-type: Simple
test-suite tests
main-is: foo.hs
type: exitcode-stdio-1.0
build-depends: base, tasty, tasty-hunit
```
```hs
import Control.Concurrent
import Control.Exception
import Test.Tasty
import Test.Tasty.HUnit

main :: IO ()
main = defaultMain $
testCase "test" $ do
putStrLn "Sleeping..."
threadDelay 100000000 `finally`
( do
putStrLn "finally.1"
threadDelay 1000000
putStrLn "finally.2"
)
```

1. Run `stack test`
2. Ctrl-C after seeing "Sleeping..."

### Expected

Should show the output
```
test: Sleeping...
finally.1
finally.2
tests: SignalException 15
```

### Actual

Got output
```
test: Sleeping...
finally.1
tests: SignalException 15
```

### Stack version

~~~text
stack --version
Version 2.11.1, Git revision c1167a6abc3f4978ccded5ba0246a57387da0e2f x86_64 hpack-0.35.2
~~~

### Method of installation

* GHCup

### Platform

MacOS M2 arm

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.