INNER CODE UNIT · Python
run_subprocess
open-quantum-safe/oqs-provider · scripts/common.py:86
def run_subprocess(command, working_dir='.', expected_returncode=0, input=None, env=os.environ):
"""
Helper function to run a shell command and report success/failure
depending on the exit status of the shell command.
"""
# Note we need to capture stdout/stderr from the subprocess,
# then print it, which pytest will then capture and
# buffer appropriately
print(working_dir + " > " + " ".join(command))
result = subprocess.run(
command,
input=input,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd=working_dir,
env=env
)