mirror of https://github.com/containers/podman.git
Fix locale issues with WSL version detection
Since wsl --version triggers help, which triggers an error code, use that instead of text detection. [NO NEW TESTS NEEDED] Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
This commit is contained in:
parent
527cf365c1
commit
cbca395291
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue