|
|
|
@ -22,6 +22,7 @@ import (
|
|
|
|
|
"os/exec"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strings"
|
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
@ -29,6 +30,11 @@ import (
|
|
|
|
|
"helm.sh/helm/pkg/plugin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type pluginError struct {
|
|
|
|
|
error
|
|
|
|
|
code int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// loadPlugins loads plugins into the command list.
|
|
|
|
|
//
|
|
|
|
|
// This follows a different pattern than the other commands because it has
|
|
|
|
@ -91,7 +97,11 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) {
|
|
|
|
|
if err := prog.Run(); err != nil {
|
|
|
|
|
if eerr, ok := err.(*exec.ExitError); ok {
|
|
|
|
|
os.Stderr.Write(eerr.Stderr)
|
|
|
|
|
return errors.Errorf("plugin %q exited with error", md.Name)
|
|
|
|
|
status := eerr.Sys().(syscall.WaitStatus)
|
|
|
|
|
return pluginError{
|
|
|
|
|
error: errors.Errorf("plugin %q exited with error", md.Name),
|
|
|
|
|
code: status.ExitStatus(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|