|
|
@ -22,7 +22,7 @@ import os
|
|
|
|
import subprocess
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def process_open(command, quotes=(), env=None, sout=subprocess.PIPE, serr=subprocess.PIPE):
|
|
|
|
def process_open(command, quotes=(), env=None, sout=subprocess.PIPE, serr=subprocess.PIPE, newlines=True):
|
|
|
|
# Linux py2.7 encode as list without quotes no empty element for parameters
|
|
|
|
# Linux py2.7 encode as list without quotes no empty element for parameters
|
|
|
|
# linux py3.x no encode and as list without quotes no empty element for parameters
|
|
|
|
# linux py3.x no encode and as list without quotes no empty element for parameters
|
|
|
|
# windows py2.7 encode as string with quotes empty element for parameters is okay
|
|
|
|
# windows py2.7 encode as string with quotes empty element for parameters is okay
|
|
|
@ -41,12 +41,13 @@ def process_open(command, quotes=(), env=None, sout=subprocess.PIPE, serr=subpro
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
exc_command = [x for x in command]
|
|
|
|
exc_command = [x for x in command]
|
|
|
|
|
|
|
|
|
|
|
|
return subprocess.Popen(exc_command, shell=False, stdout=sout, stderr=serr, universal_newlines=True, env=env)
|
|
|
|
return subprocess.Popen(exc_command, shell=False, stdout=sout, stderr=serr, universal_newlines=newlines, env=env)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def process_wait(command, serr=subprocess.PIPE):
|
|
|
|
def process_wait(command, serr=subprocess.PIPE):
|
|
|
|
# Run command, wait for process to terminate, and return an iterator over lines of its output.
|
|
|
|
# Run command, wait for process to terminate, and return an iterator over lines of its output.
|
|
|
|
p = process_open(command, serr=serr)
|
|
|
|
newlines = os.name != 'nt'
|
|
|
|
|
|
|
|
p = process_open(command, serr=serr, newlines=newlines)
|
|
|
|
p.wait()
|
|
|
|
p.wait()
|
|
|
|
for line in p.stdout.readlines():
|
|
|
|
for line in p.stdout.readlines():
|
|
|
|
if isinstance(line, bytes):
|
|
|
|
if isinstance(line, bytes):
|
|
|
|