package infra import ( "fmt" "os/exec" "strings" ) // SSHDownload descarga un archivo del host remoto al filesystem local via scp. func SSHDownload(conn SSHConn, remotePath, localPath string) error { args := conn.scpArgs() src := fmt.Sprintf("%s:%s", conn.destination(), remotePath) args = append(args, src, localPath) out, err := exec.Command("scp", args...).CombinedOutput() if err != nil { return fmt.Errorf("scp download from %s: %s", conn.destination(), strings.TrimSpace(string(out))) } return nil }