[OE-core] [PATCH 5/5] oeqa/utils/commands.py: Command class improve validations/decoding in output

Aníbal Limón anibal.limon at linux.intel.com
Thu Jul 28 14:34:31 UTC 2016



On 07/27/2016 10:18 PM, Leonardo Sandoval wrote:
> Hi Anibal,
> 
> 
> El 07/27/2016 a las 05:40 PM, Aníbal Limón escribió:
>> When run a command sometimes the output isn't provided so validate
> I wonder if this problem is related to a timeout, so at some point this
> is reached and no output is shown.

This could be one scenario but the output needs to be validated in order
to don't crash trying to use a None var.

	alimon

>> before trying to encode to utf-8, also some output like BIOS/EFI
>> contains characters that can't be codified into utf-8 for this reason
>> set errors='replace'.
>>
>> [YOCTO #10019]
>>
>> Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
>> ---
>>   meta/lib/oeqa/utils/commands.py | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/lib/oeqa/utils/commands.py
>> b/meta/lib/oeqa/utils/commands.py
>> index 4f79d15..a8e184d 100644
>> --- a/meta/lib/oeqa/utils/commands.py
>> +++ b/meta/lib/oeqa/utils/commands.py
>> @@ -78,7 +78,10 @@ class Command(object):
>>                   self.process.kill()
>>                   self.thread.join()
>>   -        self.output = self.output.decode("utf-8").rstrip()
>> +        if not self.output:
>> +            self.output = ""
>> +        else:
>> +            self.output = self.output.decode("utf-8",
>> errors='replace').rstrip()
>>           self.status = self.process.poll()
>>             self.log.debug("Command '%s' returned %d as exit code." %
>> (self.cmd, self.status))
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20160728/e4e73616/attachment-0002.sig>


More information about the Openembedded-core mailing list