INNER CODE UNIT · Python
_exec_binary
pegasus-isi/pegasus · packages/pegasus-python/src/Pegasus/cli/main.py:41
def _exec_binary(binary_name: str, args) -> None:
"""Exec a compiled (non-Python) CLI tool installed alongside this
interpreter — e.g. pegasus-transfer, which CMake installs directly into
<venv>/bin/ rather than exposing as a console_scripts wrapper (see
top-level CMakeLists.txt / packages/pegasus-transfer/CMakeLists.txt).
"""
candidate = Path(sys.executable).parent / binary_name
path = str(candidate) if candidate.exists() else shutil.which(binary_name)
if not path:
click.echo(f"pegasus: {binary_name}: executable not found", err=True)
sys.exit(1)
os.execv(path, [path] + list(args))
# ── Command factory helpers ──────────────────────────────────────────────────
_PASSTHROUGH = {"ignore_unknown_options": True, "allow_extra_args": True}