@@ -5,7 +5,6 @@ package store
5
5
6
6
import (
7
7
"fmt"
8
- "os/exec"
9
8
"regexp"
10
9
"strings"
11
10
@@ -26,7 +25,7 @@ func inspectStatus(instDir string, inst *Instance, y *limayaml.LimaYAML) {
26
25
inst .SSHLocalPort = 22
27
26
28
27
if inst .Status == StatusRunning {
29
- sshAddr , err := getWslSSHAddress (inst .Name )
28
+ sshAddr , err := GetSSHAddress (inst .Name )
30
29
if err == nil {
31
30
inst .SSHAddress = sshAddr
32
31
} else {
@@ -118,21 +117,5 @@ func GetWslStatus(instName string) (string, error) {
118
117
}
119
118
120
119
func GetSSHAddress (instName string ) (string , error ) {
121
- return getWslSSHAddress (instName )
122
- }
123
-
124
- // GetWslSSHAddress runs a hostname command to get the IP from inside of a wsl2 VM.
125
- //
126
- // Expected output (whitespace preserved, [] for optional):
127
- // PS > wsl -d <distroName> bash -c hostname -I | cut -d' ' -f1
128
- // 168.1.1.1 [10.0.0.1]
129
- func getWslSSHAddress (instName string ) (string , error ) {
130
- distroName := "lima-" + instName
131
- cmd := exec .Command ("wsl.exe" , "-d" , distroName , "bash" , "-c" , `hostname -I | cut -d ' ' -f1` )
132
- out , err := cmd .CombinedOutput ()
133
- if err != nil {
134
- return "" , fmt .Errorf ("failed to get hostname for instance %q, err: %w (out=%q)" , instName , err , string (out ))
135
- }
136
-
137
- return strings .TrimSpace (string (out )), nil
120
+ return "127.0.0.1" , nil
138
121
}
0 commit comments