diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-09-24 18:01:38 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-09-24 18:01:38 +0200 |
commit | e195665788a6eebec78007602c13198ec6ce3458 (patch) | |
tree | 4018336190f5515bf278fc9ce556f0d7cda7ae41 /fb.py | |
parent | f49403ae2c8b04f8ff76e074c780c6867f64f935 (diff) |
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-x | fb.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 |