diff --git a/pkg/machine/machine_windows.go b/pkg/machine/machine_windows.go index eb279673d4..2348bb0ee8 100644 --- a/pkg/machine/machine_windows.go +++ b/pkg/machine/machine_windows.go @@ -20,6 +20,7 @@ import ( "github.com/containers/podman/v6/pkg/machine/env" "github.com/containers/podman/v6/pkg/machine/sockets" "github.com/sirupsen/logrus" + "go.podman.io/common/pkg/config" "go.podman.io/storage/pkg/fileutils" ) @@ -132,7 +133,11 @@ func launchWinProxy(opts WinProxyOpts) (bool, string, error) { globalName := PipeNameAvailable(GlobalNamedPipe, GlobalNameWait) - command, err := FindExecutablePeer(winSSHProxy) + cfg, err := config.Default() + if err != nil { + return globalName, "", err + } + command, err := cfg.FindHelperBinary(winSSHProxy, false) if err != nil { return globalName, "", err } @@ -241,20 +246,6 @@ func sendQuit(tid uint32) { _, _, _ = postMessage.Call(uintptr(tid), WM_QUIT, 0, 0) } -func FindExecutablePeer(name string) (string, error) { - exe, err := os.Executable() - if err != nil { - return "", err - } - - exe, err = EvalSymlinksOrClean(exe) - if err != nil { - return "", err - } - - return filepath.Join(filepath.Dir(exe), name), nil -} - func EvalSymlinksOrClean(filePath string) (string, error) { fileInfo, err := os.Lstat(filePath) if err != nil { diff --git a/pkg/machine/wsl/usermodenet.go b/pkg/machine/wsl/usermodenet.go index 55c3af7a9b..7081f642a7 100644 --- a/pkg/machine/wsl/usermodenet.go +++ b/pkg/machine/wsl/usermodenet.go @@ -9,12 +9,12 @@ import ( "os/exec" "path/filepath" - "github.com/containers/podman/v6/pkg/machine" "github.com/containers/podman/v6/pkg/machine/env" "github.com/containers/podman/v6/pkg/machine/vmconfigs" "github.com/containers/podman/v6/pkg/machine/wsl/wutil" "github.com/containers/podman/v6/pkg/specgen" "github.com/sirupsen/logrus" + "go.podman.io/common/pkg/config" ) const gvForwarderPath = "/usr/libexec/podman/gvforwarder" @@ -78,7 +78,11 @@ func startUserModeNetworking(mc *vmconfigs.MachineConfig) error { return nil } - exe, err := machine.FindExecutablePeer(gvProxy) + cfg, err := config.Default() + if err != nil { + return err + } + exe, err := cfg.FindHelperBinary(gvProxy, false) if err != nil { return fmt.Errorf("could not locate %s, which is necessary for user-mode networking, please reinstall", gvProxy) }