diff --git a/internal/cli/root/builder.go b/internal/cli/root/builder.go index a8b56b0648..500edd4a9b 100644 --- a/internal/cli/root/builder.go +++ b/internal/cli/root/builder.go @@ -173,6 +173,7 @@ Use the --help flag with any command for more info on that command.`, return nil }, + // PersistentPostRun only runs if the command is successful PersistentPostRun: func(cmd *cobra.Command, _ []string) { // we don't run the release alert feature on the completion command if strings.HasPrefix(cmd.CommandPath(), fmt.Sprintf("%s %s", atlas, "completion")) { diff --git a/internal/plugin/plugin.go b/internal/plugin/plugin.go index b59f360895..d3889c2be6 100644 --- a/internal/plugin/plugin.go +++ b/internal/plugin/plugin.go @@ -152,7 +152,15 @@ func (p *Plugin) Run(cmd *cobra.Command, args []string) error { execCmd.Stdout = cmd.OutOrStdout() execCmd.Stderr = cmd.OutOrStderr() execCmd.Env = os.Environ() - return execCmd.Run() + if err := execCmd.Run(); err != nil { + var exitErr *exec.ExitError + if errors.As(err, &exitErr) { + cmd.SilenceErrors = true + _, _ = log.Debugf("Silenced error: %v", exitErr) + } + return err + } + return nil } func (p *Plugin) Uninstall() error {