Documentation
¶
Overview ¶
Package initcmd resolves the initial command and its shebang helper chain before the container process starts. It receives CLI command names, PATH values, and skip directories from the runtime, and feeds local-command augmentation plus the launcher-ready executable path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveLocalCommands ¶
DeriveLocalCommands returns local_commands entries that describe the initial executable absPath and, if it is a #!-script, the chain of helpers the kernel will invoke to run it.
The result always begins with absPath. If absPath starts with "#!", the interpreter is appended as an absolute-path rule. When the interpreter is env-like (basename "env"), the first non-flag token in the shebang argument is appended as a basename rule so the actual language runtime is also kept on the local side.
Errors reading the file are non-fatal; the function returns the entries it could derive plus the error so the caller can log it. log must be non-nil; the shebang outcome is recorded at trace level (whether a shebang was found, its interpreter, and whether the env-target branch fired).
func LookPath ¶
func LookPath(ctx context.Context, log *slog.Logger, name, pathEnv string, skipDirs ...string) (string, error)
LookPath resolves name to an absolute, executable path by searching pathEnv (a colon-separated PATH-style string), skipping any directory listed in skipDirs. Behavior mirrors exec.LookPath with one addition: directories whose cleaned form matches an entry in skipDirs are transparently bypassed.
If name contains a slash, PATH is not consulted; the path is stat'd directly and converted to its absolute form against the current working directory.
log must be non-nil; the search emits trace-level diagnostics for every PATH entry inspected and for the final hit, so callers can see which $PATH segment served the resolution.
Types ¶
This section is empty.