INNER CODE UNIT · Python
candidate
pegasus-isi/pegasus · packages/pegasus-python/src/Pegasus/cli/main.py:47
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}
def _script_cmd(name: str, script: str, help: str, *, worker: bool = False):
"""Return a Click command that delegates to a Python CLI script."""
@click.command(
name=name,