From e82db349083c22f0a0314708fec116abf2d58bcf Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Thu, 18 May 2023 15:35:26 +0200 Subject: [PATCH] if the running binary is the old running one we don't do anything otherwise we break the agent after the auto-update --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 0620d9e78..b25aad543 100755 --- a/main.go +++ b/main.go @@ -444,9 +444,14 @@ func loop() { }() } -// oldInstallExixts will return true if an old installation of the agent exixts (on macos) +// oldInstallExists will return true if an old installation of the agent exists (on macos) and is not the process running func oldInstallExists() bool { oldAgentPath := config.GetDefaultHomeDir().Join("Applications", "ArduinoCreateAgent") + currentBinary, _ := os.Executable() + // if the current running binary is the old one we don't need to do anything + if paths.New(currentBinary).IsInsideDir(oldAgentPath) { + return false + } return oldAgentPath.Exist() }