summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorTaylor Hoff <primdevs@protonmail.com>2018-12-21 16:52:57 -0500
committerAndreas Rumpf <rumpf_a@web.de>2018-12-21 22:52:57 +0100
commit8869aa74dba5559805909e3fd8d4db27d6e0cc37 (patch)
tree869a2673249295e8b1d884edf9355f66da2e4e57 /lib/pure
parent8aa5d126fe5bd2b0b01997cbd12799940b0ae33c (diff)
downloadNim-8869aa74dba5559805909e3fd8d4db27d6e0cc37.tar.gz
Stop false positives in distros.detectOs (#10062)
* Stop false positives in distros.nim

* Fix bad string comparison on line 176 of distros.nim
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/distros.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/distros.nim b/lib/pure/distros.nim
index 4bf1c3da3..0f1ffb1ab 100644
--- a/lib/pure/distros.nim
+++ b/lib/pure/distros.nim
@@ -141,8 +141,8 @@ template unameRelease(cmd, cache): untyped =
     cache = (when defined(nimscript): gorge(cmd) else: execProcess(cmd))
   cache
 
-template uname(): untyped = unameRelease("uname -a", unameRes)
-template release(): untyped = unameRelease("lsb_release -a", releaseRes)
+template uname(): untyped = unameRelease("uname -o", unameRes)
+template release(): untyped = unameRelease("lsb_release -d", releaseRes)
 template hostnamectl(): untyped = unameRelease("hostnamectl", hostnamectlRes)
 
 proc detectOsImpl(d: Distribution): bool =
@@ -173,7 +173,7 @@ proc detectOsImpl(d: Distribution): bool =
     result = defined(haiku)
   else:
     let dd = toLowerAscii($d)
-    result = dd in toLowerAscii(uname()) or dd in toLowerAscii(release()) or dd in toLowerAscii(hostnamectl())
+    result = dd in toLowerAscii(uname()) or dd in toLowerAscii(release()) or ("operating system: " & dd) in toLowerAscii(hostnamectl())
 
 template detectOs*(d: untyped): bool =
   ## Distro/OS detection. For convenience the