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

Method Runf

core/utils/ssh/ssh.go:131–142  ·  view source on GitHub ↗
(shell string, args ...interface{})

Source from the content-addressed store, hash-verified

129}
130
131func (c *SSHClient) Runf(shell string, args ...interface{}) (string, error) {
132 shell = c.SudoItem + " " + shell
133 shell = strings.ReplaceAll(shell, " && ", fmt.Sprintf(" && %s ", c.SudoItem))
134 session, err := c.Client.NewSession()
135 if err != nil {
136 return "", err
137 }
138 defer session.Close()
139 buf, err := session.CombinedOutput(fmt.Sprintf(shell, args...))
140
141 return string(buf), err
142}
143
144func (c *SSHClient) Close() {
145 if c.Client != nil {

Callers 4

CpFileWithCheckMethod · 0.95
NewWithClientFunction · 0.80
runFunction · 0.80
RunScriptMethod · 0.80

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected