summaryrefslogtreecommitdiff
path: root/pkg/machine/qemu/machine.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/machine/qemu/machine.go')
-rw-r--r--pkg/machine/qemu/machine.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 92a16dda7..30d96ce08 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -293,9 +293,14 @@ func (v *MachineVM) SSH(name string, opts machine.SSHOptions) error {
sshDestination := v.RemoteUsername + "@localhost"
port := strconv.Itoa(v.Port)
- fmt.Printf("Connecting to vm %s. To close connection, use `~.` or `exit`\n", v.Name)
+ args := []string{"-i", v.IdentityPath, "-p", port, sshDestination}
+ if opts.Execute {
+ args = append(args, opts.Args...)
+ } else {
+ fmt.Printf("Connecting to vm %s. To close connection, use `~.` or `exit`\n", v.Name)
+ }
- cmd := exec.Command("ssh", "-i", v.IdentityPath, "-p", port, sshDestination)
+ cmd := exec.Command("ssh", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin