Skip to content

Commit

Permalink
Print the driver stdout/stderr if we fail to decode it in jenkins. (#567
Browse files Browse the repository at this point in the history
)

* Print the driver stdout/stderr if we fail to decode it in jenkins.

* Fix whitespace.

* Add explanation.
  • Loading branch information
robertnishihara authored and pcmoritz committed May 21, 2017
1 parent 849d2aa commit 07b21e0
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions test/jenkins_tests/multi_node_docker_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,25 @@ def wait_for_output(proc):
A tuple of the stdout and stderr of the process as strings.
"""
stdout_data, stderr_data = proc.communicate()
stdout_data = (stdout_data.decode("ascii") if stdout_data is not None
else None)
stderr_data = (stderr_data.decode("ascii") if stderr_data is not None
else None)

if stdout_data is not None:
try:
# NOTE(rkn): This try/except block is here because I once saw an
# exception raised here and want to print more information if that
# happens again.
stdout_data = stdout_data.decode("ascii")
except UnicodeDecodeError:
raise Exception("Failed to decode stdout_data:", stdout_data)

if stderr_data is not None:
try:
# NOTE(rkn): This try/except block is here because I once saw an
# exception raised here and want to print more information if that
# happens again.
stderr_data = stderr_data.decode("ascii")
except UnicodeDecodeError:
raise Exception("Failed to decode stderr_data:", stderr_data)

return stdout_data, stderr_data


Expand Down

0 comments on commit 07b21e0

Please sign in to comment.