Skip to content

feat(proc): add resolveExecutable for consumer resolver reuse - #37

Merged
HaoZeke merged 1 commit into
mainfrom
feat/proc-resolve-executable
Nov 19, 2026
Merged

HaoZeke merged 1 commit into
mainfrom
feat/proc-resolve-executable

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

eessi-arch-guard resolves command names by hand in resolve in
zig/guard.zig, and eb-staged-rebuild does the same in which in
zig/probe.zig. Both fall back to /bin:/usr/bin when PATH is unset.

proc.resolveExecutable returns an absolute path for an executable
regular file, either from a name that holds a slash or from a PATH
lookup through which, and returns null when no executable regular file
resolves. A null path_env selects the same /bin:/usr/bin default.
The slash-path branch frees its allocated path before each null return.

The new test resolveExecutable resolves slash paths and PATH lookup in
src/proc.zig checks slash-path and PATH resolution under
std.testing.allocator, and checks the null returns for a file that is
not executable, for a directory and for an absent name.

`eessi-arch-guard` resolves command names by hand in `resolve` in
`zig/guard.zig`, and `eb-staged-rebuild` does the same in `which` in
`zig/probe.zig`. Both fall back to `/bin:/usr/bin` when PATH is unset.

`proc.resolveExecutable` returns an absolute path for an executable
regular file, either from a name that holds a slash or from a PATH
lookup through `which`, and returns null when no executable regular file
resolves. A null `path_env` selects the same `/bin:/usr/bin` default.
The slash-path branch frees its allocated path before each null return.

The new test `resolveExecutable resolves slash paths and PATH lookup` in
`src/proc.zig` checks slash-path and PATH resolution under
`std.testing.allocator`, and checks the null returns for a file that is
not executable, for a directory and for an absent name.
@HaoZeke
HaoZeke changed the base branch from refactor/proc-executable-file-check to main November 19, 2026 04:43
@HaoZeke
HaoZeke merged commit e68d396 into main Nov 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant