[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Fixing an unexpected issue during test interrupts



commit e447d3e24cc852795dce9b77da703c2ec77cd2d0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Feb 21 15:36:14 2012 -0800

    Fixing an unexpected issue during test interrupts
    
    When we get a KeyboardInterrupt (ie, the user presses ctrl+c) we sometimes
    don't have a tor process to kill which results in an unexpected stacktrace.
    I'm not quite sure why, but if a process doesn't exist then... well... guess
    we don't need to kill it.
---
 test/runner.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/test/runner.py b/test/runner.py
index 564f503..4b61e8a 100644
--- a/test/runner.py
+++ b/test/runner.py
@@ -214,7 +214,12 @@ class Runner:
       test.output.print_noline("Shutting down tor... ", *STATUS_ATTR)
       
       if self._tor_process:
-        self._tor_process.kill()
+        # 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()
+        except OSError: pass
+        
         self._tor_process.communicate() # blocks until the process is done
       
       # if we've made a temporary data directory then clean it up

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits