commit 728b71e1dfccb7c2fc350a03682217b26effaaeb Author: Damian Johnson atagar@torproject.org Date: Sun Dec 1 12:53:39 2019 -0800
Errors when tor process unexpectedly terminates
Couple fixes for issues caught by teor...
https://trac.torproject.org/projects/tor/ticket/32398
I reproed this by issuing a 'killall tor' during our integ tests. This produced a couple errors depending on when the process dies...
Traceback (most recent call last): File "run_tests.py", line 468, in <module> main() File "run_tests.py", line 304, in main if not integ_runner.assert_tor_is_running(): File "/home/atagar/Desktop/stem/test/runner.py", line 507, in assert_tor_is_running process_output = (self._tor_process.stdout.read() + '\n\n' + self._tor_process.stderr.read()).strip() TypeError: can't concat bytes to str
Traceback (most recent call last): File "run_tests.py", line 468, in <module> main() File "run_tests.py", line 304, in main if not integ_runner.assert_tor_is_running(): File "/home/atagar/Desktop/stem/test/runner.py", line 502, in assert_tor_is_running process_status = self._tor_process.poll() # None if running AttributeError: 'NoneType' object has no attribute 'poll' --- test/runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/test/runner.py b/test/runner.py index c343ed57..d8adb585 100644 --- a/test/runner.py +++ b/test/runner.py @@ -499,12 +499,16 @@ class Runner(object): provides **False**. """
+ if not self._tor_process: + println('Tor process failed to initialize', ERROR) + return False + process_status = self._tor_process.poll() # None if running
if process_status is None: return True else: - process_output = (self._tor_process.stdout.read() + '\n\n' + self._tor_process.stderr.read()).strip() + process_output = stem.util.str_tools._to_unicode(self._tor_process.stdout.read() + b'\n\n' + self._tor_process.stderr.read()).strip() println('\n%s\nOur tor process ended prematurely with exit status %s\n%s\n\n%s' % ('=' * 60, process_status, '=' * 60, process_output), ERROR) return False
tor-commits@lists.torproject.org