Description
Expected Behavior
When a cram test terminates, all running background tasks (e.g. started via &
) should be terminated too.
A reasonable alternative would be to wait for all tasks to terminate. As some background tasks never terminate and that behavior can be replicated by calling wait
I think the first option is preferable.
Actual Behavior
Background tasks continue to run and never terminate.
Reproduction
- Create a cram test that start some server in the background, e.g.
$ ncat -l 2000 -k -c 'xargs -n1 echo' &
dune runtest
- The server is still available and responds to e.g.
ncat localhost 2000
Specifications
- Version of
dune
(output ofdune --version
): 3.18.2 - Version of
ocaml
(output ofocamlc --version
): 5.3.0 - Operating system (distribution and version): Fedora
Workaround
Adding pkill -P $$
as the last line to a cram test kills all child tasks.