INNER CODE UNIT · Python
run_subprocess
open-quantum-safe/oqs-provider · oqs-template/generate.py:137
def run_subprocess(command, outfilename=None, working_dir='.', expected_returncode=0, input=None, ignore_returncode=False):
result = subprocess.run(
command,
input=input,
stdout=(open(outfilename, "w") if outfilename!=None else subprocess.PIPE),
stderr=subprocess.PIPE,
cwd=working_dir,
)
if not(ignore_returncode) and (result.returncode != expected_returncode):
if outfilename == None:
print(result.stdout.decode('utf-8'))
assert False, "Got unexpected return code {}".format(result.returncode)
# For list.append in Jinja templates
Jinja2 = jinja2.Environment(loader=jinja2.FileSystemLoader(searchpath="."),extensions=['jinja2.ext.do'])
def file_get_contents(filename, encoding=None):