diff options
| author | Catherine Devlin <catherine.devlin@gmail.com> | 2011-02-02 08:13:03 -0500 |
|---|---|---|
| committer | Catherine Devlin <catherine.devlin@gmail.com> | 2011-02-02 08:13:03 -0500 |
| commit | 13116e3fffcafc0d588dc4737c4731f8c6bfab63 (patch) | |
| tree | 85d5170e8059daeeae3e4d763fce05ae7bd0be89 /cmd2.py | |
| parent | 3534ea12158115682623da37037cc110d67799ac (diff) | |
| download | cmd2-git-13116e3fffcafc0d588dc4737c4731f8c6bfab63.tar.gz | |
fix xclip trapping bug
Diffstat (limited to 'cmd2.py')
| -rwxr-xr-x | cmd2.py | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -189,15 +189,16 @@ else: subprocess.check_call('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) can_clip = True except AttributeError: # check_call not defined, Python < 2.5 - teststring = 'Testing for presence of xclip.' - xclipproc = subprocess.Popen('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) - xclipproc.stdin.write(teststring) - xclipproc.stdin.close() - xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) - if xclipproc.stdout.read() == teststring: - can_clip = True - except (subprocess.CalledProcessError, OSError, IOError): - pass + try: + teststring = 'Testing for presence of xclip.' + xclipproc = subprocess.Popen('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) + xclipproc.stdin.write(teststring) + xclipproc.stdin.close() + xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) + if xclipproc.stdout.read() == teststring: + can_clip = True + except (subprocess.CalledProcessError, OSError, IOError): + pass if can_clip: def get_paste_buffer(): xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) |
