summaryrefslogtreecommitdiffstats
path: root/fb.py
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-09-24 18:01:38 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-09-24 18:01:38 +0200
commite195665788a6eebec78007602c13198ec6ce3458 (patch)
tree4018336190f5515bf278fc9ce556f0d7cda7ae41 /fb.py
parentf49403ae2c8b04f8ff76e074c780c6867f64f935 (diff)
Fix xclip hanging if fb output is piped elsewherev2.0.32.0.3
xclip forks a child that listens for clipboard requests and returns the copied content when necessary. When used with a pipe (`echo test | fb | cat`) this leads to cat blocking because cat's stdin is still open. I'm not sure why that happens, but closing stdout and stderr for xclip fixes the problem. This has also been done like this in the older shell client. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.py')
-rwxr-xr-xfb.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/fb.py b/fb.py
index 4f6868a..d0dc694 100755
--- a/fb.py
+++ b/fb.py
@@ -626,8 +626,9 @@ class FBClient:
def setClipboard(self, content):
try:
- p = subprocess.Popen([self.config['clipboard_cmd']], stdin=subprocess.PIPE)
- p.communicate(input=content.encode('utf-8'))
+ with open('/dev/null', 'w') as devnull:
+ p = subprocess.Popen([self.config['clipboard_cmd']], stdin=subprocess.PIPE, stdout=devnull, stderr=devnull)
+ p.communicate(input=content.encode('utf-8'))
except OSError as e:
if e.errno == errno.ENOENT:
return