From 1ee0939f698defceb9a2bf25fdd3335d3d7c885d Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 21 Sep 2020 22:42:41 +0300 Subject: [PATCH] doctor: ignore # comments in /etc/os-release files too --- cmd/tools/vdoctor.v | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmd/tools/vdoctor.v b/cmd/tools/vdoctor.v index 0cd38008de..a44c723306 100644 --- a/cmd/tools/vdoctor.v +++ b/cmd/tools/vdoctor.v @@ -130,10 +130,18 @@ fn (mut a App) get_linux_os_name() string { } mut vals := map[string]string for line in lines { - x := line.split('=') - if x.len > 1 { - vals[x[0]] = x[1].trim('"') + sline := line.trim(' ') + if sline.len == 0 { + continue } + if sline[0] == `#` { + continue + } + x := sline.split('=') + if x.len < 2 { + continue + } + vals[x[0]] = x[1].trim('"') } if vals['PRETTY_NAME'] == '' { continue