(path: str)
| 43 | |
| 44 | |
| 45 | def get_buck2_version(path: str) -> Optional[str]: |
| 46 | try: |
| 47 | runner = Buck2Runner(path) |
| 48 | output = runner.run(["--version"]) |
| 49 | |
| 50 | # Example output: |
| 51 | # buck2 38f7c508bf1b87bcdc816bf56d1b9f2d2411c6be <build-id> |
| 52 | # |
| 53 | # We want the second value. |
| 54 | |
| 55 | return output[0].split()[1] |
| 56 | |
| 57 | except Exception as e: |
| 58 | print(f"Failed to retrieve buck2 version: {e}.", file=sys.stderr) |
| 59 | return None |
nothing calls this directly
no test coverage detected