Skip to content
Snippets Groups Projects
Commit 728b71e1 authored by Damian Johnson's avatar Damian Johnson
Browse files

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'
parent 1543c078
Branches
Tags
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment