summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-09-01 19:31:27 +0200
committerAraq <rumpf_a@web.de>2017-09-01 19:31:27 +0200
commita43eae8e6c77149be77082388bb0fa546b9c97a7 (patch)
tree82e9079112439017fd4c4ccdd0a8f8949fd80d80 /lib
parent85dc40c121c285c340c192d4fb30cabc63a9c11b (diff)
downloadNim-a43eae8e6c77149be77082388bb0fa546b9c97a7.tar.gz
os.findExe: do not return binaries in the cwd
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/os.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index b85181edf..a14976d53 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -141,7 +141,12 @@ proc findExe*(exe: string, followSymlinks: bool = true;
   ## meets the actual file. This behavior can be disabled if desired.
   for ext in extensions:
     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"))
   for candidate in split(path, PathSep):
     when defined(windows):