Implement daemon mode with launchd integration#14
Merged
munezaclovis merged 4 commits intomainfrom Mar 5, 2026
Merged
Conversation
…mon-aware lifecycle - Add launchctl wrapper (Load, Unload, Restart, IsLoaded, GetPID) with human-readable error messages - Add plist sync (NeedsSync, SyncIfNeeded) to detect and apply plist changes when PHP version switches - Add --background/--foreground flags to pv start; --background installs plist and loads via launchctl with health check polling - Make pv stop daemon-aware: unloads launchd service when in daemon mode, falls back to PID file + SIGTERM for foreground - Make pv restart daemon-aware: uses launchctl kickstart for atomic restart in daemon mode - Enhance pv status to show daemon/foreground mode with PID - Add pv service install/uninstall for RunAtLoad auto-start on login - Add --error and --daemon flags to pv log for daemon log files - Add DaemonLogPath/DaemonErrLogPath config helpers - Wire pv use to auto-sync plist and restart daemon on PHP version switch - Add 10 unit tests (launchctl helpers, sync detection)
pv log now shows daemon logs (pv.log) when running as daemon, caddy logs when running in foreground — no flag needed. Added --access flag to explicitly view FrankenPHP access logs regardless of mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Load,Unload,Restart,IsLoaded,GetPID) with human-readable error messagesNeedsSync,SyncIfNeeded) to detect and apply config driftpv start --backgroundinstalls plist and loads via launchd with health check pollingpv stopis daemon-aware: unloads launchd service or falls back to SIGTERMpv restartuseslaunchctl kickstartfor atomic daemon restartpv statusshows daemon/foreground mode with PIDpv service install/uninstallfor RunAtLoad auto-start on loginpv log --error/pv log --daemonfor daemon-specific log filespv useauto-syncs plist and restarts daemon on PHP version switchTest plan
go test ./internal/daemon/ -v)go test ./internal/...)