avoid doAssert on contents of osReleaseFile (#16955)

This commit is contained in:
n5m 2021-02-15 13:21:41 +00:00 • committed by GitHub
commit 55722fe04d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -120,7 +120,7 @@ proc osReleaseFile*(): Config {.since: (1, 5).} =
import parsecfg import parsecfg
when defined(linux): when defined(linux):
let data = osReleaseFile() let data = osReleaseFile()
doAssert data.getSectionValue("", "NAME").len > 0 ## the data is up to each distro. echo "OS name: ", data.getSectionValue("", "NAME") ## the data is up to each distro.
# We do not use a {.strdefine.} because Standard says it *must* be that path. # We do not use a {.strdefine.} because Standard says it *must* be that path.
for osReleaseFile in ["/etc/os-release", "/usr/lib/os-release"]: for osReleaseFile in ["/etc/os-release", "/usr/lib/os-release"]: