Cotal TypeScript packages
    Preparing search index...

    Function resolveOnPath

    • Resolve bin to a concrete executable path, or undefined if not found. The single shared resolver behind every "is this binary available / what exactly will we launch" decision:

      • a connector's requires preflight (manager, CLI manifest, cotal status, cotal setup) — boolean-ised as !!resolveOnPath(bin);
      • the PtyRuntime, which launches the EXACT path returned (resolve once; never validate one file and then launch a different one).

      env is explicit so a caller resolves against the SAME environment it will act on. Preflights pass the operator env (default process.env); the PtyRuntime passes spec.env — its post-P3-isolation launch env — so executable selection can't escape isolation: a poisoned manager PATH can't make the child launch a different shim than the preflight saw.

      POSIX: the name IS the file — a bare name is looked up across PATH, an explicit path checked as given, each via accessSync(X_OK) on a regular file. Windows: there is no execute bit, so accessSync(X_OK) is existence-only; a bare name (or a path lacking a known executable extension) is tried against each PATHEXT extension IN ORDER — executables before scripts — so a real claude.exe beats a claude.cmd shim in the same directory; a name that already carries a PATHEXT extension is taken as-is.

      Parameters

      • bin: string
      • env: ProcessEnv = process.env

      Returns string | undefined