Fix freeze on copy when xclip is installed on Linux #1547
Merged
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.
This Pull Request fixes/closes #1497
It changes the following:
I was able to reproduce the linked issue. If I run
killall xclip
then the UI resumes normal function. This issue started with e371153. Removing the.stderr(Stdio::piped())
line fixes the freezing, but breaks the error reporting.xclip
waits for input on stdin. Something about piping stderr and stdin seems to cause the program to continue waiting for input. I tried different arguments to pass to xclip to tell it to exit, but nothing I tried seemed to work. I tried writing \x03 (End of Text) and \x04 (End of Transmission) and a few others that may have indicated to xclip to close. I tried passing-l 1
(loop once then exit) which fixes the freezing, but results in the wrong thing being set on the clipboard. (It would always set the previous thing I copied, instead of the last)In the end, passing a boolean to the function to indicate whether or not stderr should be piped seems to do the trick. If the command fails, we retry with
xsel
anyway, and report the error from that command. So the stderr output fromxclip
isn't needed.I followed the checklist:
make check
without errors