MCPcopy Index your code
hub / github.com/python/mypy / execute

Function execute

misc/incremental_checker.py:68–83  ·  view source on GitHub ↗
(command: list[str], fail_on_error: bool = True)

Source from the content-addressed store, hash-verified

66
67
68def execute(command: list[str], fail_on_error: bool = True) -> tuple[str, str, int]:
69 proc = subprocess.Popen(
70 " ".join(command), stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True
71 )
72 stdout_bytes, stderr_bytes = proc.communicate()
73 stdout, stderr = stdout_bytes.decode("utf-8"), stderr_bytes.decode("utf-8")
74 if fail_on_error and proc.returncode != 0:
75 print("EXECUTED COMMAND:", repr(command))
76 print("RETURN CODE:", proc.returncode)
77 print()
78 print("STDOUT:")
79 print_offset(stdout)
80 print("STDERR:")
81 print_offset(stderr)
82 raise RuntimeError("Unexpected error from external tool.")
83 return stdout, stderr, proc.returncode
84
85
86def ensure_environment_is_ready(mypy_path: str, temp_repo_path: str, mypy_cache_path: str) -> None:

Callers 7

initialize_repoFunction · 0.70
get_commitsFunction · 0.70
run_mypyFunction · 0.70
start_daemonFunction · 0.70
stop_daemonFunction · 0.70
set_expectedFunction · 0.70
test_incrementalFunction · 0.70

Calls 6

printFunction · 0.85
reprFunction · 0.85
RuntimeErrorClass · 0.85
print_offsetFunction · 0.70
joinMethod · 0.45
decodeMethod · 0.45

Tested by 1

test_incrementalFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…