pkg/machine/e2e: move windows-specific function to windows file

This allows to remove the 'nolint' annotation.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-03-27 16:31:48 -07:00
parent cc4d904dd2
commit bed6ee6bb7
2 changed files with 19 additions and 18 deletions

View File

@ -259,21 +259,3 @@ func isVmtype(vmType define.VMType) bool {
func isWSL() bool {
return isVmtype(define.WSLVirt)
}
// Only used on Windows
//
//nolint:unparam,unused
func runSystemCommand(binary string, cmdArgs []string, timeout time.Duration, wait bool) (*machineSession, error) {
GinkgoWriter.Println(binary + " " + strings.Join(cmdArgs, " "))
c := exec.Command(binary, cmdArgs...)
session, err := Start(c, GinkgoWriter, GinkgoWriter)
if err != nil {
Fail(fmt.Sprintf("Unable to start session: %q", err))
return nil, err
}
ms := machineSession{session}
if wait {
ms.waitWithTimeout(timeout)
}
return &ms, nil
}

View File

@ -4,6 +4,10 @@ import (
"fmt"
"os/exec"
"strings"
"time"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega/gexec"
"github.com/containers/podman/v5/pkg/machine/define"
)
@ -34,3 +38,18 @@ func getOtherProvider() string {
}
return ""
}
func runSystemCommand(binary string, cmdArgs []string, timeout time.Duration, wait bool) (*machineSession, error) {
GinkgoWriter.Println(binary + " " + strings.Join(cmdArgs, " "))
c := exec.Command(binary, cmdArgs...)
session, err := Start(c, GinkgoWriter, GinkgoWriter)
if err != nil {
Fail(fmt.Sprintf("Unable to start session: %q", err))
return nil, err
}
ms := machineSession{session}
if wait {
ms.waitWithTimeout(timeout)
}
return &ms, nil
}