[pike] Handle utf-8 when running python commands
Manual backport of Ia4b015da432398d46878cff4ee58dd87f304e8b4 The backport couldn't be clean so I proceeded to manual patch from master into stable/pike. Change-Id: Id483329cf680669e0b3d6a72b1bb030ef81ec3da Related-Bug: #1722792
This commit is contained in:
parent
242756f751
commit
c0ff8d6ac2
|
@ -570,6 +570,15 @@ def _run_command(args, env=None, name=None):
|
|||
"""
|
||||
if name is None:
|
||||
name = args[0]
|
||||
|
||||
if env is None:
|
||||
env = os.environ
|
||||
env = env.copy()
|
||||
|
||||
# When running a localized python script, we need to tell it that we're
|
||||
# using utf-8 for stdout, otherwise it can't tell because of the pipe.
|
||||
env['PYTHONIOENCODING'] = 'utf8'
|
||||
|
||||
try:
|
||||
return subprocess.check_output(args,
|
||||
stderr=subprocess.STDOUT,
|
||||
|
@ -588,6 +597,15 @@ def _run_live_command(args, env=None, name=None):
|
|||
"""
|
||||
if name is None:
|
||||
name = args[0]
|
||||
|
||||
if env is None:
|
||||
env = os.environ
|
||||
env = env.copy()
|
||||
|
||||
# When running a localized python script, we need to tell it that we're
|
||||
# using utf-8 for stdout, otherwise it can't tell because of the pipe.
|
||||
env['PYTHONIOENCODING'] = 'utf8'
|
||||
|
||||
process = subprocess.Popen(args, env=env,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
|
|
Loading…
Reference in New Issue