cli: windows username contains spaces (#2124)

fix: windows username contains spaces
This commit is contained in:
aby913 2025-11-27 23:55:23 +08:00 committed by GitHub
parent a282878cfe
commit ca1d7ebd09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,7 +78,7 @@ func (i *InstallAppxPackage) Execute(runtime connector.Runtime) error {
wslAppxPackage := wslAppxPackageObj.(*files.KubeBinary)
var ps = &utils.PowerShellCommandExecutor{
Commands: []string{fmt.Sprintf("Add-AppxPackage %s -ForceUpdateFromAnyVersion", wslAppxPackage.Path())},
Commands: []string{fmt.Sprintf("Add-AppxPackage \"%s\" -ForceUpdateFromAnyVersion", wslAppxPackage.Path())},
}
if _, err := ps.Run(); err != nil {
@ -216,7 +216,7 @@ func (i *InstallWSLDistro) Execute(runtime connector.Runtime) error {
logger.Infof("%s path: %s", ubuntuTool, installerPath)
var checkInstallerPs = &utils.PowerShellCommandExecutor{
Commands: []string{fmt.Sprintf("Test-Path %s", installerPath)},
Commands: []string{fmt.Sprintf("Test-Path \"%s\"", installerPath)},
}
installerExists, err := checkInstallerPs.Run()
if err != nil {