@@ -20,7 +20,6 @@ import (
20
20
"context"
21
21
"errors"
22
22
"fmt"
23
- "io/ioutil"
24
23
"net/http"
25
24
"os"
26
25
"os/exec"
@@ -164,22 +163,8 @@ func getUserAgentHeader() map[string]string {
164
163
}
165
164
}
166
165
167
- func detectWsl () (bool , error ) {
168
- if _ , err := os .Stat ("/proc/version" ); err == nil {
169
- b , err := ioutil .ReadFile ("/proc/version" )
170
- if err != nil {
171
- return false , fmt .Errorf ("read /proc/version: %w" , err )
172
- }
173
- str := strings .ToLower (string (b ))
174
- if strings .Contains (str , "microsoft" ) {
175
- return true , nil
176
- }
177
- }
178
- return false , nil
179
- }
180
-
181
166
func getMiniKubeFilename () (string , error ) {
182
- if found , _ := detectWsl (); found {
167
+ if found , _ := util . DetectWSL (); found {
183
168
filename , err := exec .LookPath ("minikube.exe" )
184
169
if err != nil {
185
170
return "" , errors .New ("unable to find minikube.exe. Please add it to PATH environment variable" )
@@ -221,7 +206,8 @@ func getMinikubeDockerEnv(minikubeProfile string) (map[string]string, error) {
221
206
env [kv [0 ]] = kv [1 ]
222
207
}
223
208
224
- if found , _ := detectWsl (); found {
209
+ if found , _ := util .DetectWSL (); found {
210
+ // rewrite Unix path to Windows
225
211
cmd := exec .Command ("wslpath" , env ["DOCKER_CERT_PATH" ])
226
212
out , err := util .RunCmdOut (cmd )
227
213
if err == nil {
0 commit comments