Can't kill background process started in setup_file #912
Labels
Component: Bash Code
Everything regarding the bash code
Priority: High
Broken behavior in specific environments like in parallel mode or only on some operating systems
Size: Large
Changes across several files
Status: Unconfirmend
No reproducer was provided or the reproducer did not work for maintainers.
Type: Bug
After reading through issue #205 and issue-205.bats, I'm able to start a nodeJS-based process in the background from
setup_file()
and it does not hang my tests. However, I can't figure out how to kill this process inteardown_file
.To Reproduce
Steps to reproduce the behavior:
It's probably easiest to see what I'm trying to do by applying this diff:
and then running
./bin/bats test/bats.bats
. When the test suite completes, runps -ef | grep "sleep 2222" | grep -v grep
.Expected behavior
I expected to see at most one instance of
sleep 2222
running, but there are two:Environment (please complete the following information):
bash --version
: [e.g. 5.1]:GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Additional context
I'm pretty unfamiliar with BATS, so I may be doing something stupid/silly. Attempting to store the PID in
setup_file
and then killing it inteardown_file
seemed reasonable, but it doesn't work, so... how does one start a service in background and then kill it once all the tests have completed? I just want to spin up my app, send it some requests usingcurl
, and verify that the responses are what's expected.The text was updated successfully, but these errors were encountered: