mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-27 03:42:49 +00:00
Redirect xsel std streams to /dev/null
Prevents hanging if the streams are blocked. Fixes #102
This commit is contained in:
parent
6b933e33f5
commit
9d62d087e0
1 changed files with 2 additions and 2 deletions
|
|
@ -181,7 +181,7 @@ def get_primary_selection():
|
|||
return '' # There is no primary selection on OS X
|
||||
# glfw has no way to get the primary selection
|
||||
# https://github.com/glfw/glfw/issues/894
|
||||
return subprocess.check_output(['xsel', '-p']).decode('utf-8')
|
||||
return subprocess.check_output(['xsel', '-p'], stderr=open(os.devnull, 'wb'), stdin=open(os.devnull, 'rb')).decode('utf-8')
|
||||
|
||||
|
||||
def base64_encode(
|
||||
|
|
@ -203,7 +203,7 @@ def set_primary_selection(text):
|
|||
return # There is no primary selection on OS X
|
||||
if isinstance(text, str):
|
||||
text = text.encode('utf-8')
|
||||
p = subprocess.Popen(['xsel', '-i', '-p'], stdin=subprocess.PIPE)
|
||||
p = subprocess.Popen(['xsel', '-i', '-p'], stdin=subprocess.PIPE, stdout=open(os.devnull, 'wb'), stderr=subprocess.STDOUT)
|
||||
p.stdin.write(text), p.stdin.close()
|
||||
p.wait()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue