Repository navigation
feat(proc): add resolveExecutable for consumer resolver reuse - #37
Merged
Merged
Conversation
`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
changed the base branch from
refactor/proc-executable-file-check
to
main
November 19, 2026 04:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
eessi-arch-guardresolves command names by hand inresolveinzig/guard.zig, andeb-staged-rebuilddoes the same inwhichinzig/probe.zig. Both fall back to/bin:/usr/binwhen PATH is unset.proc.resolveExecutablereturns an absolute path for an executableregular file, either from a name that holds a slash or from a PATH
lookup through
which, and returns null when no executable regular fileresolves. A null
path_envselects the same/bin:/usr/bindefault.The slash-path branch frees its allocated path before each null return.
The new test
resolveExecutable resolves slash paths and PATH lookupinsrc/proc.zigchecks slash-path and PATH resolution understd.testing.allocator, and checks the null returns for a file that isnot executable, for a directory and for an absent name.