Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e97c3e5

Browse files
authored
Fix xsel import when clipboard is empty, and add timeout failsafe (kivy#8682)
* Add timeout to `clipboard_xsel` at import time * Call '--version' in `xsel` subprocess Guarantees some return value, even if the clipboard is empty. * Remove meaningless try/except
1 parent f546e9a commit e97c3e5

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

kivy/core/clipboard/clipboard_xsel.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@
1111
if platform != 'linux':
1212
raise SystemError('unsupported platform for xsel clipboard')
1313

14-
try:
15-
import subprocess
16-
p = subprocess.Popen(['xsel'], stdout=subprocess.PIPE)
17-
p.communicate()
18-
except:
19-
raise
14+
import subprocess
15+
p = subprocess.Popen(['xsel', '--version'], stdout=subprocess.PIPE)
16+
p.communicate(timeout=1)
2017

2118

2219
class ClipboardXsel(ClipboardExternalBase):

0 commit comments

Comments
 (0)