From 571c842bd357ee626019ea97d030fb772fc654ed Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 19 Mar 2026 21:05:19 +0100 Subject: [PATCH] hyperV: fix powershell path escape To avoid special chars from being interpreted. Signed-off-by: Paul Holzinger --- pkg/machine/hyperv/stubber.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/machine/hyperv/stubber.go b/pkg/machine/hyperv/stubber.go index 3f229b6243..4c646258e5 100644 --- a/pkg/machine/hyperv/stubber.go +++ b/pkg/machine/hyperv/stubber.go @@ -694,10 +694,11 @@ func (h HyperVStubber) UpdateSSHPort(_ *vmconfigs.MachineConfig, _ int) error { } func resizeDisk(newSize strongunits.GiB, imagePath *define.VMFile) error { - resize := exec.Command("powershell", []string{"-command", fmt.Sprintf("Resize-VHD \"%s\" %d", imagePath.GetPath(), newSize.ToBytes())}...) + resize := exec.Command("powershell", "-command", fmt.Sprintf("Resize-VHD \"$ENV:IMAGE_PATH\" %d", newSize.ToBytes())) logrus.Debug(resize.Args) resize.Stdout = os.Stdout resize.Stderr = os.Stderr + resize.Env = append(os.Environ(), "IMAGE_PATH="+imagePath.GetPath()) if err := resize.Run(); err != nil { return fmt.Errorf("resizing image: %q", err) }