INNER CODE UNIT · Python
run
XRPLF/rippled · package/build_pkg.py:64
def run(*command: object, cwd: Path | None = None) -> None:
"""Echo a command and run it."""
argv = [str(part) for part in command]
print("+ " + " ".join(argv), flush=True)
subprocess.run(argv, check=True, cwd=cwd)
def capture(*command: object) -> str:
"""Run a command and return its stdout, stripped."""
argv = [str(part) for part in command]
# stderr is left alone so a failing command explains itself.
return subprocess.run(
argv, stdout=subprocess.PIPE, text=True, check=True
).stdout.strip()
def package_version(reported: str, channel: str) -> str:
"""Normalise a reported version into one the package formats accept.