comparison cmd2.py @ 78:94d89298a8ef

catch ioerrors when checking for xclip
author catherine.devlin@gmail.com
date Mon, 30 Jun 2008 12:23:14 -0400
parents bb44928c3856
children
comparison
equal deleted inserted replaced
77:bb44928c3856 78:94d89298a8ef
107 xclipproc.stdin.write(teststring) 107 xclipproc.stdin.write(teststring)
108 xclipproc.stdin.close() 108 xclipproc.stdin.close()
109 xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 109 xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
110 if xclipproc.stdout.read() == teststring: 110 if xclipproc.stdout.read() == teststring:
111 can_clip = True 111 can_clip = True
112 except (subprocess.CalledProcessError, OSError): 112 except (subprocess.CalledProcessError, OSError, IOError):
113 pass 113 pass
114 if can_clip: 114 if can_clip:
115 def getPasteBuffer(): 115 def getPasteBuffer():
116 xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 116 xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
117 return xclipproc.stdout.read() 117 return xclipproc.stdout.read()