Closed
Description
I'm following the indications in https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs and that seems to work when bg processes like sleep 5s 3>- &
are launched from the test body or the (per-test) setup
function. But when launched from the (per-file) setup_file
function, sleep 5s 3>- &
is still blocking the bats execution after all tests are done.
To reproduce:
@test "bats does not hang on bg process in setup_file" {
cd "$BATS_TEST_TMPDIR"
cat <<EOF >foo.bats
setup_file (){
sleep 5s 3>- &
}
$(echo @test) "foo" {
true
}
EOF
SECONDS=0
run bats foo.bats
test $SECONDS -lt 2
}
Is this a known issue? I have seen very recent work around this topic in #525 but not sure if that will apply to this particular issue.
Environment:
- Bats 1.5.0
- OS: Fedora 33
- Bash version: GNU bash, version 5.0.17(1)-release (x86_64-redhat-linux-gnu)