From 662c19551ac6d052969e37769996ac2e818ad8aa Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 13 Sep 2020 10:06:20 -0700 Subject: [PATCH] control/controlclient: deal with localized 'Version' string getting Windows version --- control/controlclient/hostinfo_windows.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/control/controlclient/hostinfo_windows.go b/control/controlclient/hostinfo_windows.go index 1d5298a9f..07cb4ce4e 100644 --- a/control/controlclient/hostinfo_windows.go +++ b/control/controlclient/hostinfo_windows.go @@ -21,6 +21,10 @@ func osVersionWindows() string { s := strings.TrimSpace(string(out)) s = strings.TrimPrefix(s, "Microsoft Windows [") s = strings.TrimSuffix(s, "]") - s = strings.TrimPrefix(s, "Version ") // is this localized? do it last in case. - return s // "10.0.19041.388", ideally + + // "Version 10.x.y.z", with "Version" localized. Keep only stuff after the space. + if sp := strings.Index(s, " "); sp != -1 { + s = s[sp+1:] + } + return s // "10.0.19041.388", ideally }