Skip to content

Commit

Permalink
Merge pull request #20240 from n1hility/fix-wsl-version-detection
Browse files Browse the repository at this point in the history
Fix locale issues with WSL version detection
  • Loading branch information
openshift-ci[bot] authored Oct 3, 2023
2 parents fdf3e4b + cbca395 commit 2457c25
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pkg/machine/wsl/wutil/wutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,13 @@ func IsWSLInstalled() bool {

func IsWSLStoreVersionInstalled() bool {
cmd := SilentExecCmd("wsl", "--version")
out, err := cmd.StdoutPipe()
cmd.Stdout = nil
cmd.Stderr = nil
if err != nil {
return false
}
if err = cmd.Start(); err != nil {
return false
}
hasVersion := matchOutputLine(out, "WSL version:")
if err := cmd.Wait(); err != nil {
if err := cmd.Run(); err != nil {
return false
}

return hasVersion
return true
}

func matchOutputLine(output io.ReadCloser, match string) bool {
Expand Down

0 comments on commit 2457c25

Please sign in to comment.