fix(helm): handle errors when plugin command is not found

If a 'command:' is not found for a plugin, it will not result in an
ExitError, but in a PathError. This prevents that condition from
panicing.

Closes #1609
parent 190dafbc
...@@ -78,9 +78,11 @@ func loadPlugins(baseCmd *cobra.Command, home helmpath.Home, out io.Writer) { ...@@ -78,9 +78,11 @@ func loadPlugins(baseCmd *cobra.Command, home helmpath.Home, out io.Writer) {
prog.Stdout = out prog.Stdout = out
prog.Stderr = os.Stderr prog.Stderr = os.Stderr
if err := prog.Run(); err != nil { if err := prog.Run(); err != nil {
eerr := err.(*exec.ExitError) if eerr, ok := err.(*exec.ExitError); ok {
os.Stderr.Write(eerr.Stderr) os.Stderr.Write(eerr.Stderr)
return fmt.Errorf("plugin %q exited with error", md.Name) return fmt.Errorf("plugin %q exited with error", md.Name)
}
return err
} }
return nil return nil
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment