MCPcopy Index your code
hub / github.com/helm/helm / runCLI

Method runCLI

internal/plugin/runtime_subprocess.go:192–227  ·  view source on GitHub ↗
(input *Input)

Source from the content-addressed store, hash-verified

190}
191
192func (r *SubprocessPluginRuntime) runCLI(input *Input) (*Output, error) {
193 if _, ok := input.Message.(schema.InputMessageCLIV1); !ok {
194 return nil, fmt.Errorf("plugin %q input message does not implement InputMessageCLIV1", r.metadata.Name)
195 }
196
197 extraArgs := input.Message.(schema.InputMessageCLIV1).ExtraArgs
198
199 cmds := r.RuntimeConfig.PlatformCommand
200
201 env := ParseEnv(os.Environ())
202 maps.Insert(env, maps.All(r.EnvVars))
203 maps.Insert(env, maps.All(ParseEnv(input.Env)))
204 env["HELM_PLUGIN_NAME"] = r.metadata.Name
205 env["HELM_PLUGIN_DIR"] = r.pluginDir
206
207 command, args, err := PrepareCommands(cmds, true, extraArgs, env)
208 if err != nil {
209 return nil, fmt.Errorf("failed to prepare plugin command: %w", err)
210 }
211
212 cmd := exec.Command(command, args...)
213 cmd.Env = FormatEnv(env)
214
215 cmd.Stdin = input.Stdin
216 cmd.Stdout = input.Stdout
217 cmd.Stderr = input.Stderr
218
219 slog.Debug("executing plugin command", slog.String("pluginName", r.metadata.Name), slog.String("command", cmd.String()))
220 if err := executeCmd(cmd, r.metadata.Name); err != nil {
221 return nil, err
222 }
223
224 return &Output{
225 Message: schema.OutputMessageCLIV1{},
226 }, nil
227}
228
229func (r *SubprocessPluginRuntime) runPostrenderer(input *Input) (*Output, error) {
230 if _, ok := input.Message.(schema.InputMessagePostRendererV1); !ok {

Callers 1

InvokeMethod · 0.95

Calls 6

ParseEnvFunction · 0.85
PrepareCommandsFunction · 0.85
FormatEnvFunction · 0.85
executeCmdFunction · 0.85
AllMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected