Companion keeper: after a restart the panel opens the Companion that ran last if it is not running
- only in the watchdog's first 10 minutes, never another version, never during an upgrade - SC verified end to end; laptop SSH to the SC Macs; configs synced Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -292,6 +292,9 @@ def upgrade_companion(base, say=print, source=None):
|
||||
import urllib.request
|
||||
root = os.path.expanduser("~/Library/Application Support/companion")
|
||||
app = "/Applications/Companion 5.0.7.app"
|
||||
# The watchdog's CompanionKeeper must not reopen the old Companion in the middle of this.
|
||||
with open(os.path.join(PARENT, "companion-upgrading"), "w") as f:
|
||||
f.write(str(time.time()))
|
||||
if not os.path.exists(app) and source: # standalone: the .dmg (or .zip) downloaded from bitfocus.io
|
||||
install_companion_from(source, app, say)
|
||||
if not os.path.exists(app):
|
||||
@@ -323,6 +326,10 @@ def upgrade_companion(base, say=print, source=None):
|
||||
try:
|
||||
discover.companion_get({"companion": {}}, "/api/connections", 2)
|
||||
say("Companion 5.0.7 is running. In System Settings > General > Login Items, replace the old Companion with 5.0.7.")
|
||||
try:
|
||||
os.remove(os.path.join(PARENT, "companion-upgrading"))
|
||||
except OSError:
|
||||
pass
|
||||
return True
|
||||
except OSError:
|
||||
time.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user