comparison cmd2.py @ 31:dd64c0e3dbe0 v0.3.1

fixed err in python 2.4 xclip detection
author catherine@localhost
date Mon, 19 May 2008 10:08:23 -0400
parents c4bd5f1a6968
children 11d44bf343c7 f472921d6189
comparison
equal deleted inserted replaced
30:786b3ea3e440 31:dd64c0e3dbe0
99 try: 99 try:
100 subprocess.check_call('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 100 subprocess.check_call('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
101 can_clip = True 101 can_clip = True
102 except AttributeError: # check_call not defined, Python < 2.5 102 except AttributeError: # check_call not defined, Python < 2.5
103 teststring = 'Testing for presence of xclip.' 103 teststring = 'Testing for presence of xclip.'
104 xclipproc = subprocess.check_call('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 104 #import pdb; pdb.set_trace()
105 xclipproc = subprocess.Popen('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
105 xclipproc.stdin.write(teststring) 106 xclipproc.stdin.write(teststring)
107 xclipproc.stdin.close()
108 xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
106 if xclipproc.stdout.read() == teststring: 109 if xclipproc.stdout.read() == teststring:
107 can_clip = True 110 can_clip = True
108 except (subprocess.CalledProcessError, OSError): 111 except (subprocess.CalledProcessError, OSError):
109 pass 112 pass
110 if can_clip: 113 if can_clip: