From e195665788a6eebec78007602c13198ec6ce3458 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 24 Sep 2016 18:01:38 +0200 Subject: Fix xclip hanging if fb output is piped elsewhere 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 --- fb.py | 5 +++-- 1 file 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 -- cgit v1.2.3-24-g4f1b