From dcc2bc598a74f4ed8a2c81dd6696cf4fd5510832 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Wed, 30 Nov 2016 16:57:04 -0700 Subject: [PATCH] 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 --- cmd/helm/plugins.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/helm/plugins.go b/cmd/helm/plugins.go index a9a4383f5..d0f317a4b 100644 --- a/cmd/helm/plugins.go +++ b/cmd/helm/plugins.go @@ -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 },