fix(windows): Make sure to log the final error message (#15346)

This commit is contained in:
Sven Rebhan 2024-05-15 12:35:31 -04:00 committed by GitHub
parent 1a00a48d54
commit ae326bc805
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -374,7 +374,11 @@ func runApp(args []string, outputBuffer io.Writer, pprof Server, c TelegrafConfi
defer memguard.Purge()
defer logger.CloseLogging()
return app.Run(args)
if err := app.Run(args); err != nil {
log.Printf("E! %s", err)
return err
}
return nil
}
func main() {
@ -385,6 +389,6 @@ func main() {
pprof := NewPprofServer()
c := config.NewConfig()
if err := runApp(os.Args, os.Stdout, pprof, c, &agent); err != nil {
log.Fatalf("E! %s", err)
os.Exit(1)
}
}