# HG changeset patch # User catherine.devlin@gmail.com # Date 1296652383 18000 # Node ID b5f904daae8340cf3e62ca8acb927cdfe7241e5b # Parent db32ab37051bd8128f97f8c37a8d788ea0bba603 fix xclip trapping bug diff -r db32ab37051b -r b5f904daae83 cmd2.py --- a/cmd2.py Wed Feb 02 08:00:26 2011 -0500 +++ b/cmd2.py Wed Feb 02 08:13:03 2011 -0500 @@ -189,15 +189,16 @@ 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)