diff --git a/commands/report.go b/commands/report.go index 9e1e61e7..9f9847cb 100644 --- a/commands/report.go +++ b/commands/report.go @@ -330,15 +330,21 @@ func (p *ReportCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{} util.Log.Infof("Loaded: %s", dir) var res models.ScanResults + hasError := false for _, r := range loaded { if len(r.Errors) == 0 { res = append(res, r) } else { - util.Log.Warnf("Ignored since errors occurred during scanning: %s", - r.ServerName) + util.Log.Errorf("Ignored since errors occurred during scanning: %s, err: %v", + r.ServerName, r.Errors) + hasError = true } } + if len(res) == 0 { + return subcommands.ExitFailure + } + for _, r := range res { util.Log.Debugf("%s: %s", r.ServerInfo(), @@ -424,5 +430,9 @@ func (p *ReportCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{} } } + if hasError { + return subcommands.ExitFailure + } + return subcommands.ExitSuccess }