Fixed subprocess error reporting

Moved stdout and stderr decoding to earlier stage to prevent
decode error.

Note, the code is not py3 compatible. But this change doesn't
introduce any new incompatibility, it changes order of existing
decode calls.

Change-Id: I23f7340e254ec249f00c6de9a980adac9e637983
Closes-Bug: #1399490
This commit is contained in:
Andrew Lazarev 2014-12-05 14:35:36 -08:00
parent 4b97008b0e
commit 2f9a12bcb2
1 changed files with 4 additions and 3 deletions

View File

@ -103,12 +103,13 @@ class RemoteCommandException(SaharaException):
six.text_type(ret_code))
if stderr:
self.message = '%s\nSTDERR:\n%s' % (self.message, stderr)
self.message = '%s\nSTDERR:\n%s' % (
self.message, stderr.decode('ascii', 'ignore'))
if stdout:
self.message = '%s\nSTDOUT:\n%s' % (self.message, stdout)
self.message = '%s\nSTDOUT:\n%s' % (
self.message, stdout.decode('ascii', 'ignore'))
self.message = self.message.decode('ascii', 'ignore')
super(RemoteCommandException, self).__init__()