Detect Ubuntu by checking release() and uname() (#13704)

This will improve detection of Ubuntu when running on Ubuntu on WSL. #13703
This commit is contained in:
Hayden 2020-03-20 05:59:05 -04:00 • committed by GitHub
commit f4dbdd311f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -156,7 +156,9 @@ proc detectOsImpl(d: Distribution): bool =
of Distribution.Posix: result = defined(posix)
of Distribution.MacOSX: result = defined(macosx)
of Distribution.Linux: result = defined(linux)
of Distribution.Ubuntu, Distribution.Gentoo, Distribution.FreeBSD,
of Distribution.Ubuntu:
result = "Ubuntu" in release() or ("-" & $d & " ") in uname()
of Distribution.Gentoo, Distribution.FreeBSD,
Distribution.OpenBSD:
result = ("-" & $d & " ") in uname()
of Distribution.RedHat: