Skip to content

Commit 65b5f3f

Browse files
authored
Merge pull request #1825 from pendo324/fix-windows-path-issues
fix: windows directory path containing spaces
2 parents a26c6b2 + 4180766 commit 65b5f3f

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

pkg/sshutil/sshutil.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,8 @@ func CommonOpts(useDotSSH bool) ([]string, error) {
138138
var opts []string
139139
if runtime.GOOS == "windows" {
140140
privateKeyPath = ioutilx.CanonicalWindowsPath(privateKeyPath)
141-
opts = []string{"IdentityFile=" + privateKeyPath}
142-
} else {
143-
opts = []string{"IdentityFile=\"" + privateKeyPath + "\""}
144141
}
142+
opts = []string{fmt.Sprintf(`IdentityFile="%s"`, privateKeyPath)}
145143

146144
// Append all private keys corresponding to ~/.ssh/*.pub to keep old instances working
147145
// that had been created before lima started using an internal identity.
@@ -231,11 +229,10 @@ func SSHOpts(instDir string, useDotSSH, forwardAgent bool, forwardX11 bool, forw
231229
if err != nil {
232230
return nil, err
233231
}
234-
controlPath := fmt.Sprintf("ControlPath=\"%s\"", controlSock)
235232
if runtime.GOOS == "windows" {
236233
controlSock = ioutilx.CanonicalWindowsPath(controlSock)
237-
controlPath = fmt.Sprintf("ControlPath=%s", controlSock)
238234
}
235+
controlPath := fmt.Sprintf(`ControlPath="%s"`, controlSock)
239236
opts = append(opts,
240237
fmt.Sprintf("User=%s", u.Username), // guest and host have the same username, but we should specify the username explicitly (#85)
241238
"ControlMaster=auto",

pkg/wsl2/lima-init.TEMPLATE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
set -eu; \
22
export LOG_FILE=/var/log/lima-init.log; \
33
exec > >(tee \$LOG_FILE) 2>&1; \
4-
LIMA_CIDATA_MNT=$(/usr/bin/wslpath '{{.CIDataPath}}'); \
5-
export LIMA_CIDATA_MNT; \
6-
exec \$LIMA_CIDATA_MNT/boot.sh;
4+
export LIMA_CIDATA_MNT="$(/usr/bin/wslpath '{{.CIDataPath}}')"; \
5+
exec "\$LIMA_CIDATA_MNT/boot.sh";

0 commit comments

Comments
 (0)