Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ lua-check-hammerspoon-dev: ## Run the Hammerspoon Lua check inside the Nix dev s
##@ Launchd Services

.PHONY: launchctl
launchctl: launchctl-brew-upgrader launchctl-cliproxyapi launchctl-code-syncer launchctl-dotfiles-updater launchctl-neverssl-keepalive launchctl-ollama ## Restart all launchd agents.
launchctl: launchctl-brew-upgrader launchctl-cliproxyapi launchctl-cliproxyapi-backup launchctl-code-syncer launchctl-dotfiles-updater launchctl-neverssl-keepalive launchctl-ollama ## Restart all launchd agents.

.PHONY: launchctl-brew-upgrader
launchctl-brew-upgrader: ## Restart brew-upgrader launchd agent.
Expand All @@ -621,6 +621,14 @@ launchctl-cliproxyapi: ## Restart cliproxyapi launchd agent.
@launchctl load ~/Library/LaunchAgents/org.nix-community.home.cliproxyapi.plist
@echo "✅ cliproxyapi restarted"

.PHONY: launchctl-cliproxyapi-backup
launchctl-cliproxyapi-backup: ## Restart cliproxyapi backup launchd agent.
@echo "🔄 Restarting cliproxyapi-backup..."
@launchctl unload ~/Library/LaunchAgents/org.nix-community.home.cliproxyapi-backup.plist 2>/dev/null || true
@sleep 3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a fixed sleep 3 is a common but potentially unreliable way to wait for launchctl unload to complete, as it's an asynchronous operation. If the service takes longer than 3 seconds to shut down, the subsequent launchctl load might fail or behave unexpectedly. A more robust approach would be to poll until the service is confirmed to be unloaded, or use the more modern launchctl bootout/bootstrap commands which can be synchronous.

While this pattern is used consistently across other launchctl targets in this Makefile, it would be beneficial to consider refactoring this (and other similar targets) to use a more reliable waiting mechanism in a future change to improve the robustness of these service restarts.

@launchctl load ~/Library/LaunchAgents/org.nix-community.home.cliproxyapi-backup.plist
@echo "✅ cliproxyapi-backup restarted"

.PHONY: launchctl-code-syncer
launchctl-code-syncer: ## Restart code-syncer launchd agent.
@echo "🔄 Restarting code-syncer..."
Expand Down
Loading