MCPcopy Create free account
hub / github.com/apache/tvm / run_script

Function run_script

tests/python/ci/test_utils.py:58–80  ·  view source on GitHub ↗

Wrapper to run a script and print its output if there was an error

(command: list[Any], check: bool = True, **kwargs)

Source from the content-addressed store, hash-verified

56
57
58def run_script(command: list[Any], check: bool = True, **kwargs):
59 """
60 Wrapper to run a script and print its output if there was an error
61 """
62 command = [str(c) for c in command]
63 kwargs_to_send = {
64 "stdout": subprocess.PIPE,
65 "stderr": subprocess.PIPE,
66 "encoding": "utf-8",
67 }
68 env = kwargs.pop("env", None)
69 if env is not None:
70 kwargs_to_send["env"] = {**os.environ, **env}
71 kwargs_to_send.update(kwargs)
72 proc = subprocess.run(
73 command,
74 check=False,
75 **kwargs_to_send,
76 )
77 if check and proc.returncode != 0:
78 raise RuntimeError(f"Process failed:\nstdout:\n{proc.stdout}\n\nstderr:\n{proc.stderr}")
79
80 return proc

Callers 11

testMethod · 0.85
test_cc_reviewersFunction · 0.85
test_update_branchFunction · 0.85
test_pr_commentFunction · 0.85
test_skip_ciFunction · 0.85
test_skip_globsFunction · 0.85
test_ping_reviewersFunction · 0.85
test_github_tag_teamsFunction · 0.85

Calls 4

strFunction · 0.85
popMethod · 0.45
updateMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…