diff --git a/cmd/Desktop-Bridge/main.go b/cmd/Desktop-Bridge/main.go index a881bd4f..14889e7a 100644 --- a/cmd/Desktop-Bridge/main.go +++ b/cmd/Desktop-Bridge/main.go @@ -23,7 +23,6 @@ import ( "github.com/ProtonMail/proton-bridge/v3/internal/app" "github.com/bradenaw/juniper/xslices" - "github.com/sirupsen/logrus" ) /* @@ -44,7 +43,5 @@ import ( */ func main() { - if err := app.New().Run(xslices.Filter(os.Args, func(arg string) bool { return !strings.Contains(arg, "-psn_") })); err != nil { - logrus.Fatal(err) - } + _ = app.New().Run(xslices.Filter(os.Args, func(arg string) bool { return !strings.Contains(arg, "-psn_") })) } diff --git a/internal/app/app.go b/internal/app/app.go index 1b9657a7..f130e332 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -204,7 +204,7 @@ func run(c *cli.Context) error { }() // Restart the app if requested. - return withRestarter(exe, func(restarter *restarter.Restarter) error { + err = withRestarter(exe, func(restarter *restarter.Restarter) error { // Handle crashes with various actions. return withCrashHandler(restarter, reporter, func(crashHandler *crash.Handler, quitCh <-chan struct{}) error { migrationErr := migrateOldVersions() @@ -293,6 +293,13 @@ func run(c *cli.Context) error { }) }) }) + + // if an error occurs, it must be logged now because we're about to close the log file. + if err != nil { + logrus.Fatal(err) + } + + return err } // If there's another instance already running, try to raise it and exit.