[tor-commits] [stem/master] Missing kill() fallback when ending integ tests

atagar at torproject.org atagar at torproject.org
Mon Jun 25 01:45:02 UTC 2012


commit 4e02850db89006f256290e8bc7bea7169c6cd57c
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jun 23 11:55:57 2012 -0700

    Missing kill() fallback when ending integ tests
    
    As an earlier commit mentioned, Popen.kill() is unavailable on python 2.5, and
    its fallback (os.kill()) is unavailable on Windows. Accounting for this in the
    integ test runner.
---
 test/runner.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/test/runner.py b/test/runner.py
index 1bf1860..3b696b3 100644
--- a/test/runner.py
+++ b/test/runner.py
@@ -41,6 +41,7 @@ import sys
 import time
 import stat
 import shutil
+import signal
 import logging
 import tempfile
 import threading
@@ -305,7 +306,13 @@ class Runner:
         # if the tor process has stopped on its own then the following raises
         # an OSError ([Errno 3] No such process)
         
-        try: self._tor_process.kill()
+        try:
+          if stem.prereq.is_python_26():
+            self._tor_process.kill()
+          elif not stem.util.system.is_windows():
+            os.kill(self._tor_process.pid, signal.SIGTERM)
+          else:
+            test.output.print_line("failed (unable to call kill() in python 2.5)", *ERROR_ATTR)
         except OSError: pass
         
         self._tor_process.communicate() # blocks until the process is done





More information about the tor-commits mailing list