I am currently making an audio recorder, and the script runs forever. I am currently trying to figure out a way to stop my audio recorder script, but I've had no such luck.
So far I've tried this user post: Stackoverflow Question, and tried this:
import os
os.system('pkill -f audio-recorder.py')
But, instead of just stopping it, it terminates it, which doesn't let my audio-recorder script shut down properly. See, my script is set up so that when the finally: block is reached it cleans everything up and stops recording, but if I use that user's answer it doesn't do that. Is there a way to accomplish what I'm doing, stopping a python script gently, not a full on kill?
pythonnotaudio-recorder.pysince this is a script run by interpreter.os.system('pkill -f audio-recorder.py')toos.system('pkill -f python audio-recorder.py')?-SIGTERMoption flag.pkillcommand, I don't understand why it needs to be a python script at all. Just run pkill directly.