Limit number of candidates for executables

This change ensures that the first match of an executable in the path
is retured instead of a list of candidates. This prevents a CDI spec,
for example, from containing multiple entries for a single executable
(e.g. nvidia-smi).

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-01-20 15:08:47 +01:00
parent 6706024687
commit 6237477ba3
2 changed files with 16 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ func newExecutableLocator(logger *log.Logger, root string, paths ...string) *exe
WithRoot(root),
WithSearchPaths(paths...),
WithFilter(assertExecutable),
WithCount(1),
)
l := executable{