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

Method InvokeWithEnv

internal/plugin/runtime_subprocess.go:114–133  ·  view source on GitHub ↗

InvokeWithEnv executes a plugin command with custom environment and I/O streams This method allows execution with different command/args than the plugin's default

(main string, argv []string, env []string, stdin io.Reader, stdout, stderr io.Writer)

Source from the content-addressed store, hash-verified

112// InvokeWithEnv executes a plugin command with custom environment and I/O streams
113// This method allows execution with different command/args than the plugin's default
114func (r *SubprocessPluginRuntime) InvokeWithEnv(main string, argv []string, env []string, stdin io.Reader, stdout, stderr io.Writer) error {
115 mainCmdExp := os.ExpandEnv(main)
116 cmd := exec.Command(mainCmdExp, argv...)
117 cmd.Env = slices.Clone(os.Environ())
118 cmd.Env = append(
119 cmd.Env,
120 "HELM_PLUGIN_NAME="+r.metadata.Name,
121 "HELM_PLUGIN_DIR="+r.pluginDir)
122 cmd.Env = append(cmd.Env, env...)
123
124 cmd.Stdin = stdin
125 cmd.Stdout = stdout
126 cmd.Stderr = stderr
127
128 if err := executeCmd(cmd, r.metadata.Name); err != nil {
129 return err
130 }
131
132 return nil
133}
134
135func (r *SubprocessPluginRuntime) InvokeHook(event string) error {
136 cmds := r.RuntimeConfig.PlatformHooks[event]

Callers 1

pluginDynamicCompFunction · 0.80

Calls 2

executeCmdFunction · 0.85
CloneMethod · 0.80

Tested by

no test coverage detected