I'm creating a task
with subprocess.Popen()
in Linux but if the task does not end by itself then task.kill
does not kill it.
Is there a way of forcing task
to end?
Right now my code looks like this:
task = subprocess.Popen(
final_list_subprocess, stdout=subprocess.PIPE)
try:
result, errs = task.communicate(timeout=5)
except subprocess.TimeoutExpired:
task.kill()
except:
task.kill()```