Add encoding to run_program and popen_program
This commit is contained in:
parent
877db91cb6
commit
95338f1df7
1 changed files with 6 additions and 0 deletions
|
|
@ -437,6 +437,9 @@ def ping(addr='google.com'):
|
||||||
def popen_program(cmd, pipe=False, minimized=False, shell=False, **kwargs):
|
def popen_program(cmd, pipe=False, minimized=False, shell=False, **kwargs):
|
||||||
"""Run program and return a subprocess.Popen object."""
|
"""Run program and return a subprocess.Popen object."""
|
||||||
cmd_kwargs = {'args': cmd, 'shell': shell}
|
cmd_kwargs = {'args': cmd, 'shell': shell}
|
||||||
|
for kw in ('encoding', 'errors'):
|
||||||
|
if kw in kwargs:
|
||||||
|
cmd_kwargs[kw] = kwargs[kw]
|
||||||
|
|
||||||
if minimized:
|
if minimized:
|
||||||
startupinfo = subprocess.STARTUPINFO()
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
|
@ -506,6 +509,9 @@ def run_program(cmd, check=True, pipe=True, shell=False, **kwargs):
|
||||||
cmd = ' '.join(cmd)
|
cmd = ' '.join(cmd)
|
||||||
|
|
||||||
cmd_kwargs = {'args': cmd, 'check': check, 'shell': shell}
|
cmd_kwargs = {'args': cmd, 'check': check, 'shell': shell}
|
||||||
|
for kw in ('encoding', 'errors'):
|
||||||
|
if kw in kwargs:
|
||||||
|
cmd_kwargs[kw] = kwargs[kw]
|
||||||
|
|
||||||
if pipe:
|
if pipe:
|
||||||
cmd_kwargs.update({
|
cmd_kwargs.update({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue