diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/machine/config.go | 5 | ||||
-rw-r--r-- | pkg/machine/qemu/machine.go | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/pkg/machine/config.go b/pkg/machine/config.go index 5e90dae51..2a70b8ff7 100644 --- a/pkg/machine/config.go +++ b/pkg/machine/config.go @@ -42,7 +42,10 @@ type Download struct { VMName string } -type SSHOptions struct{} +type SSHOptions struct { + Execute bool + Args []string +} type StartOptions struct{} type StopOptions struct{} 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 |