comparison cmd2.py @ 143:f0fa9965a985

catch xclip-absent input errors
author catherine@dellzilla
date Tue, 18 Nov 2008 13:12:43 -0500
parents c05afe3b5501
children 2d3477aa79d4
comparison
equal deleted inserted replaced
142:c05afe3b5501 143:f0fa9965a985
311 self.pseudo_raw_input(self.continuationPrompt))) 311 self.pseudo_raw_input(self.continuationPrompt)))
312 312
313 statekeeper = None 313 statekeeper = None
314 stop = 0 314 stop = 0
315 if statement.input: 315 if statement.input:
316 if statement.inputFrom: 316 try:
317 try: 317 if statement.inputFrom:
318 newinput = open(statement.inputFrom, 'r').read() 318 newinput = open(statement.inputFrom, 'r').read()
319 except OSError, e: 319 else:
320 print e 320 newinput = getPasteBuffer()
321 return 0 321 except (OSError,), e:
322 else: 322 print e
323 newinput = getPasteBuffer() 323 return 0
324 start, end = self.redirectInPattern.scanString(statement.fullStatement).next()[1:] 324 start, end = self.redirectInPattern.scanString(statement.fullStatement).next()[1:]
325 return self.onecmd('%s%s%s' % (statement.fullStatement[:start], 325 return self.onecmd('%s%s%s' % (statement.fullStatement[:start],
326 newinput, statement.fullStatement[end:])) 326 newinput, statement.fullStatement[end:]))
327 if statement.pipe and statement.pipeTo: 327 if statement.pipe and statement.pipeTo:
328 redirect = subprocess.Popen(statement.pipeTo, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) 328 redirect = subprocess.Popen(statement.pipeTo, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)