diff options
author | Clivar <16317699+Clivar@users.noreply.github.com> | 2022-06-12 23:44:00 +0200 |
---|---|---|
committer | Clivar <16317699+Clivar@users.noreply.github.com> | 2022-06-15 00:16:06 +0200 |
commit | 43e12c135b0de65a9000842539bc4afad82874d5 (patch) | |
tree | df01d5f03ebf44df3a858d77db7b049e81a268a5 | |
parent | b078aeb87c4ef0fdc17a69992d33404efb0ccc40 (diff) | |
download | podman-43e12c135b0de65a9000842539bc4afad82874d5.tar.gz podman-43e12c135b0de65a9000842539bc4afad82874d5.tar.bz2 podman-43e12c135b0de65a9000842539bc4afad82874d5.zip |
Fix #14416: Use absolute path to WSL binary to create ssh keys for `machine init`
Signed-off-by: Clivar <16317699+Clivar@users.noreply.github.com>
-rw-r--r-- | pkg/machine/keys.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/machine/keys.go b/pkg/machine/keys.go index 15c1f73d8..45d9801cc 100644 --- a/pkg/machine/keys.go +++ b/pkg/machine/keys.go @@ -59,7 +59,16 @@ func generatekeysPrefix(dir string, file string, passThru bool, prefix ...string args := append([]string{}, prefix[1:]...) args = append(args, sshCommand...) args = append(args, file) - cmd := exec.Command(prefix[0], args...) + + binary, err := exec.LookPath(prefix[0]) + if err != nil { + return err + } + binary, err = filepath.Abs(binary) + if err != nil { + return err + } + cmd := exec.Command(binary, args...) cmd.Dir = dir if passThru { cmd.Stdin = os.Stdin |