py3: Fix subprocess py3 compatibility

Subprocess.Popen.communicate returns a string object on python2
and a bytes object on python3.

Add universal_newlines=True parameter to keep backwards compatibility
and to return a string object on python3 also.

Story: 2008454
Task: 42930
Depends-On: Ie3921c4ae6211a8b0d290bdbdb195ce07036afbc
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I73f75dba4113af3022ad2277556c547b5afebe61
This commit is contained in:
Dan Voiculeasa 2021-08-05 21:13:54 +03:00
parent 9ced50cf38
commit a641de826a

View File

@ -25,6 +25,7 @@ def command(arguments, **kwargs):
arguments,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
**kwargs)
out, err = process.communicate()
return out, err, process.returncode