CreateDigest([FileContent(script_path, script_content.encode(), is_executable=True)]),
)
paths = []
search_path = create_path_env_var(request.search_path)
result = await Get(
FallibleProcessResult,
// We use a volatile process to force re-run since any binary found on the host system today
// could be gone tomorrow. Ideally we"d only do this for local processes since all known
// remoting configurations include a static container image as part of their cache key which
// automatically avoids this problem.
UncacheableProcess(
Process(
description=f"Searching for `{request.binary_name}` on PATH={search_path}",
level=LogLevel.DEBUG,
input_digest=script_digest,
argv=[script_path, request.binary_name],
env={"PATH": search_path},
)
),
)
if result.exit_code == 0:
paths.extend(result.stdout.decode().splitlines())
return BinaryPaths(binary_name=request.binary_name, paths=paths)