fix: rmdir a stale directory before reaching for unmount - #33
Merged
Merged
Conversation
The startup sweep unmounted every empty leftover it found, right after establishing it was not mounted, so each one walked the whole escalation. The removal count was also taken from pcall rather than from the result. Closes #31
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.
Closes #31.
cleanup_staleruns on everysetup()and calledMountPoint.unmounton each empty leftover directory immediately after confirming it was not active, so every one walked fusermount, fusermount3, umount and diskutil for something that was never mounted. It now tries a plain rmdir and only escalates if that fails, which is the case the unmount was presumably guarding.Second bug in the same three lines:
local success = pcall(vim.fn.delete, ...)is true whenever the call did not raise, including when delete returns -1, so the count included failures.unmountalso removes the directory itself, which made a naive fix undercount instead. Counting what is actually gone handles both.The function had no test coverage, which is how both survived.