feat(startup): accept a fixed-version WebView2 carried beside OpsLog
'The Evergreen installer will not install either' moves the problem out of OpsLog's reach: the runtime is a Windows component, and on a managed, offline or otherwise locked-down machine it may simply refuse. Microsoft publishes the same runtime in a FIXED VERSION form — a folder an application carries and points at, needing no installation and no administrator. That is exactly this case, so OpsLog now looks for it beside its own executable and uses it when it is there. The versioned subfolder the download unpacks into is handled, because asking someone to flatten it by hand is one more step to get wrong on a machine where nothing starts. No setting for it: that would be a question asked of the one operator least able to answer it. The folder is either there or it is not. The startup log also records the Windows build — the first thing anyone diagnosing a runtime that will not install is going to ask for.
This commit is contained in:
@@ -13,6 +13,8 @@ package main
|
||||
// answers the whole question in one line.
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/sys/windows/registry"
|
||||
)
|
||||
|
||||
@@ -47,3 +49,22 @@ func webView2Version() string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// windowsVersion reads the build from the registry, for the startup log.
|
||||
//
|
||||
// Not curiosity: "WebView2 will not install either" is a statement about the
|
||||
// machine, not about OpsLog, and the build number is the first thing anyone
|
||||
// diagnosing that will ask for.
|
||||
func windowsVersion() string {
|
||||
k, err := registry.OpenKey(registry.LOCAL_MACHINE,
|
||||
`SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
|
||||
if err != nil {
|
||||
return "unknown"
|
||||
}
|
||||
defer k.Close()
|
||||
name, _, _ := k.GetStringValue("ProductName")
|
||||
build, _, _ := k.GetStringValue("CurrentBuild")
|
||||
ubr, _, _ := k.GetIntegerValue("UBR")
|
||||
display, _, _ := k.GetStringValue("DisplayVersion")
|
||||
return fmt.Sprintf("%s %s build %s.%d", name, display, build, ubr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user