diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-10 21:30:00 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-10 21:30:00 -0400 |
commit | 08cee23ec10f22da1eb54944c8e01564c16a5c33 (patch) | |
tree | 6c1c02c6fefb7f82616cd87711b0a44ca285ab32 | |
parent | b9c56fd456b84f7eaeb98f393603907f4bf15e4d (diff) | |
download | cmd2-git-08cee23ec10f22da1eb54944c8e01564c16a5c33.tar.gz |
Attempt at fixing some extraneous output on Linux when using Python3 and xclip
-rwxr-xr-x | cmd2.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -300,7 +300,12 @@ def options(option_list, arg_desc="arg"): # Can we access the clipboard? Should always be true on Windows and Mac, but only sometimes on Linux try: - _ = pyperclip.paste() + if six.PY3 and sys.platform.startswith('linux'): + # Avoid extraneous output to stderr from xclip when clipboard is empty at cost of overwriting clipboard contents + pyperclip.copy('') + else: + # Try getting the contents of the clipboard + _ = pyperclip.paste() except pyperclip.exceptions.PyperclipException: can_clip = False else: |