from typing import Union
from subprocess import run, PIPE
def run_target(target: str, input: Union[str, bytes]) -> int:
Copyright By PowCoder代写 加微信 powcoder
Run the target program with input on its stdin.
:param target: The target program to run.
:param input: The input to pass to the target program.
:return: The return code of the target program.
if isinstance(input, str):
input = input.encode()
process = run(
input=input,
stdout=PIPE,
stderr=PIPE,
# Debug information
# f”ret={process.returncode}\n”
# f”out:\n{process.stdout}\n”
# f”err:\n{process.stderr}”
return process.returncode
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com