Skip to content

fix(launchd): --force now bootouts existing service before reinstall#7684

Closed
xandersbell wants to merge 1 commit into
NousResearch:mainfrom
xandersbell:fix/gateway-force-flag
Closed

fix(launchd): --force now bootouts existing service before reinstall#7684
xandersbell wants to merge 1 commit into
NousResearch:mainfrom
xandersbell:fix/gateway-force-flag

Conversation

@xandersbell

Copy link
Copy Markdown
Contributor

Summary

  • hermes gateway install --force on macOS would fail with exit code 5 if the service was already loaded in launchd
  • launchctl bootstrap cannot overwrite a running service — must bootout first

Fix

When --force is passed and a plist already exists, call launchctl bootout before bootstrap to cleanly unload the old service.

if force and plist_path.exists():
    label = get_launchd_label()
    subprocess.run(["launchctl", "bootout", f"{_launchd_domain()}/{label}"], check=False, timeout=90)

Testing

  • Manual: hermes -p pi gateway install --force on macOS with a service already running no longer fails

When running 'hermes gateway install --force' on macOS, the command
would fail with exit code 5 if the service was already loaded in
launchd, because bootstrap cannot overwrite a running service.

The --force flag now calls launchctl bootout before bootstrap, so the
service is cleanly unloaded before reinstalling.
@xandersbell

Copy link
Copy Markdown
Contributor Author

Closing as this has been addressed in a subsequent update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant