Expand description
Program lookup through an environment’s PATH.
A program name without / is looked up in the PATH of the environment that
the program gets: for a step, the task environment, never kizz’s own; for
kizz execute, the caller’s. Each directory of PATH is tried in order, as
execvp does: an empty entry means the working directory, and a relative entry
resolves against it. Every location checked is reported as a probe, so it
becomes a dependency of the step and a program that appears earlier in PATH
re-runs the step. The first location that holds a regular file with an execute
bit is the program.
A program name with / is not looked up: it resolves against the working
directory, and the tracer reports whether it can be run.
search_program is the lookup itself, for any name and PATH of bytes, and
reports each checked location with its outcome: ok when something is there,
and otherwise the name of the error, which it gets from the caller, such as the
tracer’s error-name query (kizz_trace::Tracer::error_name).
find_program is the lookup of run(), for a task environment of strings,
with the checked locations as accesses; search_step_program is the same
lookup with each checked location’s outcome, for the report of kizz run --output. check_path is the check that such a lookup can be made at all,
from the program name and the environment alone, which the engine makes before
the cache check.
Structs§
- NoPath
Error - A bare program name in a task environment without
PATH.
Enums§
- Program
Lookup - The result of looking up a program.
- Program
Search - The result of
search_program: the result of a lookup, with every location that it checked as a probe with its outcome.
Constants§
- PATH_
VARIABLE - The variable that lists the directories to search for programs.
Functions§
- check_
path - Check that the program
nameof a step whose environment isenvcan be looked up: a name with/needs no lookup, and any other name needs aPATHinenv. The check reads only these two values, so it gives the same answer every time, assearch_step_programdoes for a missingPATH. - find_
program - Look up the program
namefor a step whose environment isenvand whose working directory iscwd, withsearch_program. - search_
program - Look up the program
nameinsearch, the value ofPATH, orNonewhen the environment has noPATH, for a program whose working directory iscwd. Each checked location is a probe whose outcome isokwhen something is there, and otherwise the name thaterror_namegives the error number of the failed check, orunknownwhen the failure has no number. - search_
step_ program - Look up the program
namefor a step whose environment isenvand whose working directory iscwd, asfind_programdoes, keeping the outcome of each checked location, whose errorerror_namenames, for the observation report ofkizz run --output.