INNER CODE UNIT · Python
run
ExplosionEngine/Explosion · ThirdParty/ConanRecipes/build_recipes.py:123
def run(cmd: list[str], cwd: Path | None = None, redact: set[str] | None = None) -> int:
shown = " ".join("***" if redact and arg in redact else arg for arg in cmd)
print(f"\n$ {shown}", flush=True)
return subprocess.run(cmd, cwd=str(cwd) if cwd else None).returncode
def run_capture(cmd: list[str], cwd: Path | None = None) -> tuple[int, str]:
print(f"\n$ {' '.join(cmd)}", flush=True)
proc = subprocess.run(cmd, cwd=str(cwd) if cwd else None, stdout=subprocess.PIPE, text=True)
return proc.returncode, proc.stdout
def graph_recipe_node(graph_json: str, reference: str) -> dict | None:
try:
nodes = json.loads(graph_json).get("graph", {}).get("nodes", {})
except (json.JSONDecodeError, AttributeError):
return None
for node in nodes.values():