MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / Run

Method Run

core/utils/ssh/ssh.go:74–85  ·  view source on GitHub ↗
(shell string)

Source from the content-addressed store, hash-verified

72}
73
74func (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
87func (c *SSHClient) CpFileWithCheck(src, dst string) error {
88 localMd5, err := c.Runf("md5sum %s | awk '{print $1}'", src)

Callers 3

NewClientFunction · 0.95
SudoHandleCmdMethod · 0.95
IsRootMethod · 0.95

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected