From f954f897473bfee33f8c77dc466c02dc69382980 Mon Sep 17 00:00:00 2001 From: James Houlahan Date: Tue, 22 Nov 2022 11:29:22 +0100 Subject: [PATCH] GODT-2111: Fix restart on macOS --- cmd/Desktop-Bridge/main.go | 4 +++- pkg/restarter/restarter.go | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/Desktop-Bridge/main.go b/cmd/Desktop-Bridge/main.go index 68cd45b4..56072a12 100644 --- a/cmd/Desktop-Bridge/main.go +++ b/cmd/Desktop-Bridge/main.go @@ -19,8 +19,10 @@ package main import ( "os" + "strings" "github.com/ProtonMail/proton-bridge/v2/internal/app" + "github.com/bradenaw/juniper/xslices" "github.com/sirupsen/logrus" ) @@ -42,7 +44,7 @@ import ( */ func main() { - if err := app.New().Run(os.Args); err != nil { + if err := app.New().Run(xslices.Filter(os.Args, func(arg string) bool { return !strings.Contains(arg, "-psn_") })); err != nil { logrus.Fatal(err) } } diff --git a/pkg/restarter/restarter.go b/pkg/restarter/restarter.go index 1ff33afa..788ed78b 100644 --- a/pkg/restarter/restarter.go +++ b/pkg/restarter/restarter.go @@ -72,7 +72,12 @@ func (restarter *Restarter) Restart() { env[BridgeCrashCount] = "0" } - cmd := execabs.Command(restarter.exe, xslices.Join(removeFlagWithValue(os.Args[1:], "parent-pid"), restarter.flags)...) //nolint:gosec + //nolint:gosec + cmd := execabs.Command( + restarter.exe, + xslices.Join(removeFlagWithValue(os.Args[1:], "parent-pid"), restarter.flags)..., + ) + l := logrus.WithFields(logrus.Fields{ "exe": restarter.exe, "crashCount": env[BridgeCrashCount],