Kill background process

docker

#1

I’m trying to kill a python job started in background in an Alpine docker in gitlab-ci:

Python

import asyncio
def main():
    loop = asyncio.get_event_loop()
    try:
        loop.run_forever()
    except KeyboardInterrupt:
        print('Stopping')
if __name__ == '__main__':
    main()

Here are the commands that are ran.

$ COVERAGE_FILE=.coverage.test coverage run test.py &
$ TEST_PID=$!
$ echo "${TEST_PID}"
26
$ kill -SIGINT ${TEST_PID}
$ jobs -l
[1]+  26 Running                 
$ kill -9 ${TEST_PID}
$ jobs -l
[1]+  26 Running                 

I can never see the .coverage.test as the job never finishes and I’m not able to kill it