os.findExe: do not return binaries in the cwd
This commit is contained in:
parent
85dc40c121
commit
a43eae8e6c
1 changed files with 6 additions and 1 deletions
|
|
@ -141,7 +141,12 @@ proc findExe*(exe: string, followSymlinks: bool = true;
|
||||||
## meets the actual file. This behavior can be disabled if desired.
|
## meets the actual file. This behavior can be disabled if desired.
|
||||||
for ext in extensions:
|
for ext in extensions:
|
||||||
result = addFileExt(exe, ext)
|
result = addFileExt(exe, ext)
|
||||||
if existsFile(result): return
|
if existsFile(result):
|
||||||
|
# on Posix ensure we do not yield binaries in the cwd:
|
||||||
|
when defined(posix):
|
||||||
|
if isAbsolute(result): return
|
||||||
|
else:
|
||||||
|
return
|
||||||
var path = string(getEnv("PATH"))
|
var path = string(getEnv("PATH"))
|
||||||
for candidate in split(path, PathSep):
|
for candidate in split(path, PathSep):
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue