KVM test: kvm_subprocess: use kill_process_tree() to close child processes
This is safer than just killing the session leader because some processes seem
to remain alive after their session leader has exited.
Signed-off-by: Michael Goldish <mgoldish@redhat.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3685 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py
index 07303a8..ba61a8c 100755
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -367,7 +367,7 @@
return _locked(self.lock_server_running_filename)
- def close(self, sig=signal.SIGTERM):
+ def close(self, sig=signal.SIGKILL):
"""
Kill the child process if it's alive and remove temporary files.
@@ -375,10 +375,7 @@
"""
# Kill it if it's alive
if self.is_alive():
- try:
- os.kill(self.get_shell_pid(), sig)
- except:
- pass
+ kvm_utils.kill_process_tree(self.get_shell_pid(), sig)
# Wait for the server to exit
_wait(self.lock_server_running_filename)
# Call all cleanup routines