Fix daemon and server error handling#37
Merged
munezaclovis merged 4 commits intomainfrom Mar 10, 2026
Merged
Conversation
- Launchctl Load/Unload/Restart now include Go error and command output in error messages for better debugging - daemon:enable handles already-loaded service by updating plist and restarting instead of failing - Server waitForEvent returns actual errors instead of always nil - DNS WriteMsg errors are logged to stderr - All server output goes to stderr (was using stdout) - Signal cleanup via defer signal.Stop - DNS shutdown errors logged on server exit - removePID logs errors instead of silently discarding - Watcher logs ResolveVersion errors before falling back to global PHP
When linking a project that requires a secondary FrankenPHP instance (non-default PHP version) while the daemon is running, automatically restart the daemon to spawn the needed secondary process. Previously, ReconfigureServer only reloaded the main Caddy config, leaving the secondary FrankenPHP unstarted and causing 502 errors. Also fix e2e start-curl.sh to disable the daemon before starting in foreground mode, since pv install now auto-enables the daemon.
When unlinking the last project using a non-default PHP version, restart the daemon to stop the orphaned secondary FrankenPHP process. Uses caddy.ActiveVersions to check if the version is still needed.
- Guard against panic on empty DNS question slice in WriteMsg error log - Fix import ordering in link.go (daemon before detection) - Log settings load failure in unlink.go instead of silently discarding - Use ui.Fail instead of ui.Subtle for daemon restart failures - Unload daemon before reinstalling plist in enable.go (ensures new plist is picked up instead of cached version) - Fix ReconfigureServer comment: only reloads, does not restart - Fix merged channel comment: only receives from secondaries - Foreground mode hints now say "pv stop && pv start" since pv restart only reloads and cannot manage secondary FrankenPHP processes
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
daemon:enablehandles already-loaded service gracefully (updates plist and restarts)waitForEventreturns actual errors instead of always nil on child exitWriteMsgerrors, signal cleanup, PID removal errors, and watcher version resolution errors all properly loggedTest plan
go build ./...passesgo test ./...passespv daemon:enablewhen daemon already running updates and restarts cleanlypv start --foregroundlogs to stderr, not stdout