Use universal_newlines when running other commands
This will automatically convert the output to unicode/str and we will not have to worry about decoding ourselves. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
ed22e07ef9
commit
ed9d7f69a6
9 changed files with 93 additions and 54 deletions
|
|
@ -28,7 +28,7 @@ from pungi.wrappers import iso
|
|||
|
||||
def sh(log, cmd, *args, **kwargs):
|
||||
log.info('Running: %s', ' '.join(quote(x) for x in cmd))
|
||||
ret, out = shortcuts.run(cmd, *args, **kwargs)
|
||||
ret, out = shortcuts.run(cmd, *args, universal_newlines=True, **kwargs)
|
||||
if out:
|
||||
log.debug('%s', out)
|
||||
return ret, out
|
||||
|
|
@ -36,7 +36,8 @@ def sh(log, cmd, *args, **kwargs):
|
|||
|
||||
def get_lorax_dir(default='/usr/share/lorax'):
|
||||
try:
|
||||
_, out = shortcuts.run(['python3', '-c' 'import pylorax; print(pylorax.find_templates())'])
|
||||
_, out = shortcuts.run(['python3', '-c' 'import pylorax; print(pylorax.find_templates())'],
|
||||
universal_newlines=True)
|
||||
return out.strip()
|
||||
except Exception:
|
||||
return default
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue