Skip to content

Commit 571c842

Browse files
committed
hyperV: fix powershell path escape
To avoid special chars from being interpreted. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
1 parent c747adf commit 571c842

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/machine/hyperv/stubber.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,10 +694,11 @@ func (h HyperVStubber) UpdateSSHPort(_ *vmconfigs.MachineConfig, _ int) error {
694694
}
695695

696696
func resizeDisk(newSize strongunits.GiB, imagePath *define.VMFile) error {
697-
resize := exec.Command("powershell", []string{"-command", fmt.Sprintf("Resize-VHD \"%s\" %d", imagePath.GetPath(), newSize.ToBytes())}...)
697+
resize := exec.Command("powershell", "-command", fmt.Sprintf("Resize-VHD \"$ENV:IMAGE_PATH\" %d", newSize.ToBytes()))
698698
logrus.Debug(resize.Args)
699699
resize.Stdout = os.Stdout
700700
resize.Stderr = os.Stderr
701+
resize.Env = append(os.Environ(), "IMAGE_PATH="+imagePath.GetPath())
701702
if err := resize.Run(); err != nil {
702703
return fmt.Errorf("resizing image: %q", err)
703704
}

0 commit comments

Comments
 (0)