MCPcopy
hub / github.com/asdf-vm/asdf / RunCallback

Method RunCallback

internal/plugins/plugins.go:180–193  ·  view source on GitHub ↗

RunCallback invokes a callback with the given name if it exists for the plugin

(name string, arguments []string, environment map[string]string, stdOut io.Writer, errOut io.Writer)

Source from the content-addressed store, hash-verified

178
179// RunCallback invokes a callback with the given name if it exists for the plugin
180func (p Plugin) RunCallback(name string, arguments []string, environment map[string]string, stdOut io.Writer, errOut io.Writer) error {
181 callback, err := p.CallbackPath(name)
182 if err != nil {
183 return err
184 }
185
186 cmd := execute.New(fmt.Sprintf("'%s'", callback), arguments)
187
188 cmd.Env = environment
189 cmd.Stdout = stdOut
190 cmd.Stderr = errOut
191
192 return cmd.Run()
193}
194
195// CallbackPath returns the full file path to a callback script
196func (p Plugin) CallbackPath(name string) (string, error) {

Callers 15

LegacyFilenamesMethod · 0.95
UpdateMethod · 0.95
getCustomExecutablePathFunction · 0.80
ExecutableDirsFunction · 0.80
InstallOneVersionFunction · 0.80
pluginTestCommandFunction · 0.80
listAllCommandFunction · 0.80
InstallOneVersionFunction · 0.80
LatestFunction · 0.80
AllVersionsFunction · 0.80
UninstallFunction · 0.80

Calls 3

CallbackPathMethod · 0.95
NewFunction · 0.92
RunMethod · 0.80

Tested by 1

TestRunCallbackFunction · 0.64