Merge pull request #20240 from n1hility/fix-wsl-version-detection

Fix locale issues with WSL version detection
This commit is contained in:
openshift-ci[bot]
2023-10-03 13:45:07 +00:00
committed by GitHub

View File

@ -50,20 +50,13 @@ func IsWSLInstalled() bool {
func IsWSLStoreVersionInstalled() bool { func IsWSLStoreVersionInstalled() bool {
cmd := SilentExecCmd("wsl", "--version") cmd := SilentExecCmd("wsl", "--version")
out, err := cmd.StdoutPipe() cmd.Stdout = nil
cmd.Stderr = nil cmd.Stderr = nil
if err != nil { if err := cmd.Run(); err != nil {
return false
}
if err = cmd.Start(); err != nil {
return false
}
hasVersion := matchOutputLine(out, "WSL version:")
if err := cmd.Wait(); err != nil {
return false return false
} }
return hasVersion return true
} }
func matchOutputLine(output io.ReadCloser, match string) bool { func matchOutputLine(output io.ReadCloser, match string) bool {