Runs buck2 with the given args and returns its stdout as a sequence of lines.
(self, args: Sequence[str])
| 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 | |
| 45 | def get_buck2_version(path: str) -> Optional[str]: |
no test coverage detected