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
pull/1610/head
Matt Butcher 8 years ago
parent 190dafbc8e
commit dcc2bc598a
No known key found for this signature in database
GPG Key ID: DCD5F5E5EF32C345

@ -78,9 +78,11 @@ 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)
os.Stderr.Write(eerr.Stderr)
return fmt.Errorf("plugin %q exited with error", md.Name)
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
},

Loading…
Cancel
Save