INNER CODE UNIT · Python
run
94fzb/zrlog · shell/release/generate_trust_metadata.py:27
def run(command: list[str]) -> str:
result = subprocess.run(
command,
check=False,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
if result.returncode != 0:
detail = result.stderr.strip() or result.stdout.strip() or f"exit {result.returncode}"
raise RuntimeError(f"{command[0]} failed: {detail}")
return result.stdout.strip()
def write_text(path: Path, value: str) -> None:
temporary = path.with_name(path.name + ".tmp")
temporary.write_text(value, encoding="utf-8")
temporary.replace(path)