Fix updater test corrupting real LaunchAgent plist - #21
Merged
Conversation
rewrite_plist/2 always wrote when plist_path was overridden, and one test omitted the override entirely — falling through to ~/Library/LaunchAgents on the real filesystem. Every test run overwrote the plist with a temp-dir path, breaking the LaunchAgent on next login. Change the condition from `override_path || File.exists?(path)` to `File.exists?(path)` so rewrite_plist only updates files that already exist, regardless of how the path was resolved.
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
rewrite_plist/2conditionoverride_path || File.exists?(path)always wrote when an override was given, and the "skips plist rewrite" test omitted the override — falling through to~/Library/LaunchAgentson the real filesystemmix testrun overwrote the installed plist with a temp-dir binary path, breaking the LaunchAgent on next login (exit code 78)File.exists?(path)so plist is only rewritten when one already existsplist_path:isolation to the "skips" test and pre-created the plist file in the "rewrites" testTest plan
mix qualitypasses (format, compile, credo, doctor, tests)~/Library/LaunchAgents/com.severance.daemon.plistto correct binary path