MCPcopy Create free account
hub / github.com/pytorch/executorch / Buck2Runner

Class Buck2Runner

tools/cmake/buck_util.py:27–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26
27class Buck2Runner:
28 def __init__(self, tool_path: str) -> None:
29 self._path = tool_path
30
31 def run(self, args: Sequence[str]) -> list[str]:
32 """Runs buck2 with the given args and returns its stdout as a sequence of lines."""
33 try:
34 cp: subprocess.CompletedProcess = subprocess.run(
35 [self._path] + args, # type: ignore[operator]
36 capture_output=True,
37 cwd=repo_root_dir(),
38 check=True,
39 )
40 return [line.strip().decode("utf-8") for line in cp.stdout.splitlines()]
41 except subprocess.CalledProcessError as ex:
42 raise RuntimeError(ex.stderr.decode("utf-8")) from ex
43
44
45def get_buck2_version(path: str) -> Optional[str]:

Callers 1

get_buck2_versionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected