Mercurial > python-cmd2
comparison cmd2.py @ 419:fd8a2da973cb
generalizing xclip error trap
author | catherine.devlin@gmail.com |
---|---|
date | Wed, 02 Feb 2011 08:15:21 -0500 |
parents | b5f904daae83 |
children | b6beae2a2f46 |
comparison
equal
deleted
inserted
replaced
418:b5f904daae83 | 419:fd8a2da973cb |
---|---|
195 xclipproc.stdin.write(teststring) | 195 xclipproc.stdin.write(teststring) |
196 xclipproc.stdin.close() | 196 xclipproc.stdin.close() |
197 xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) | 197 xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) |
198 if xclipproc.stdout.read() == teststring: | 198 if xclipproc.stdout.read() == teststring: |
199 can_clip = True | 199 can_clip = True |
200 except (subprocess.CalledProcessError, OSError, IOError): | 200 except Exception: # hate a bare Exception call, but exception classes vary too much b/t stdlib versions |
201 pass | 201 pass |
202 if can_clip: | 202 if can_clip: |
203 def get_paste_buffer(): | 203 def get_paste_buffer(): |
204 xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) | 204 xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) |
205 return xclipproc.stdout.read() | 205 return xclipproc.stdout.read() |