(shell string)
| 72 | } |
| 73 | |
| 74 | func (c *SSHClient) Run(shell string) (string, error) { |
| 75 | shell = c.SudoItem + " " + shell |
| 76 | shell = strings.ReplaceAll(shell, " && ", fmt.Sprintf(" && %s ", c.SudoItem)) |
| 77 | session, err := c.Client.NewSession() |
| 78 | if err != nil { |
| 79 | return "", err |
| 80 | } |
| 81 | defer session.Close() |
| 82 | buf, err := session.CombinedOutput(shell) |
| 83 | |
| 84 | return string(buf), err |
| 85 | } |
| 86 | |
| 87 | func (c *SSHClient) CpFileWithCheck(src, dst string) error { |
| 88 | localMd5, err := c.Runf("md5sum %s | awk '{print $1}'", src) |
no test coverage detected