Fix: Linux clipboard fallback skips xsel when xclip is not installed#4
Fix: Linux clipboard fallback skips xsel when xclip is not installed#4TofuGG wants to merge 1 commit into
Conversation
Refactor clipboard handling for better error management and support for Linux commands.
|
Sorry for the slow review on this one, it sat in my queue longer than it should have. Thanks for your patience, and thanks for the clear write-up of the root cause. The diagnosis is right and the fix is the correct shape. A few things before I can merge: 1. Commit message Please reword 2. Checklist vs. diff The description says three regression tests were added and that Once the commit message and the tests plus changelog are in, this is good to go. Thanks! |
What does this PR do?
On Linux,
copy_to_clipboard()triedxclipandxselas fallbacks inside a single sharedtry/exceptblock. Ifxclipwasn't installed, theFileNotFoundErrorit raised escaped the loop and was caught by the outer handler — meaningxselwas never tried. Users withxselbut notxclip(common on Debian/Ubuntu) would silently fail to copy even though a working tool was present.The fix wraps each command in its own
try/exceptinside the loop, so a missing tool justcontinues to the next candidate. The macOS and Windows branches are also given their owntry/exceptblocks for the same reason.Three regression tests are added covering: xsel succeeding when xclip is absent, xclip succeeding when xsel is absent, and
Falsereturned cleanly when neither tool is installed.Related issue
No related issue.
Checklist
make test)[Unreleased]