diff options
| author | Damian Johnson <atagar@torproject.org> | 2019-12-01 12:53:39 -0800 |
|---|---|---|
| committer | Damian Johnson <atagar@torproject.org> | 2019-12-01 12:53:39 -0800 |
| commit | 728b71e1dfccb7c2fc350a03682217b26effaaeb (patch) | |
| tree | 966fe4dc0c40b6af08b503644b2cf75bb13c506e | |
| parent | 1543c078acd2b3270e8d72b62fad28fe357f5481 (diff) | |
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'
| -rw-r--r-- | test/runner.py | 6 |
1 files changed, 5 insertions, 1 deletions
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 |
