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,10 +78,12 @@ func loadPlugins(baseCmd *cobra.Command, home helmpath.Home, out io.Writer) {
prog.Stdout = out
prog.Stderr = os.Stderr
if err := prog.Run(); err != nil {
eerr := err.(*exec.ExitError)
if eerr, ok := err.(*exec.ExitError); ok {
os.Stderr.Write(eerr.Stderr)
return fmt.Errorf("plugin %q exited with error", md.Name)
}
return err
}
return nil
},
// This passes all the flags to the subcommand.
......
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