Exemplo n.º 1
0
// RunCommandThroughSSHWithWriters ...
func RunCommandThroughSSHWithWriters(sshConfigModel config.SSHConfigModel, cmdToRunWithSSH string, stdout, stderr io.Writer) error {
	sshArgs := sshConfigModel.SSHCommandArgs()
	fullArgs := append(sshArgs, cmdToRunWithSSH)

	cmd := exec.Command("ssh", fullArgs...)
	log.Debugf("RunCommandThroughSSHWithWriters: Full command to run: %v", cmd.Args)
	cmd.Stdin = os.Stdin
	cmd.Stdout = stdout
	cmd.Stderr = stderr

	return cmd.Run()
}