mirror of
https://github.com/containers/podman.git
synced 2025-06-22 18:08:11 +08:00
Merge pull request #20240 from n1hility/fix-wsl-version-detection
Fix locale issues with WSL version detection
This commit is contained in:
@ -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 {
|
||||||
|
Reference in New Issue
Block a user