comparison cmd2.py @ 127:8def9dec155f 0.4.3

trap errors
author catherine@dellzilla
date Fri, 07 Nov 2008 10:31:38 -0500
parents 197a312f2656
children 64ad2b28d69d
comparison
equal deleted inserted replaced
126:197a312f2656 127:8def9dec155f
328 else: 328 else:
329 statekeeper = Statekeeper(self, ('stdout',)) 329 statekeeper = Statekeeper(self, ('stdout',))
330 self.stdout = tempfile.TemporaryFile() 330 self.stdout = tempfile.TemporaryFile()
331 if statement.output == '>>': 331 if statement.output == '>>':
332 self.stdout.write(getPasteBuffer()) 332 self.stdout.write(getPasteBuffer())
333 stop = cmd.Cmd.onecmd(self, statement.statement) 333 try:
334 stop = cmd.Cmd.onecmd(self, statement.statement)
335 except Exception, e:
336 print str(e)
337 return False
334 try: 338 try:
335 if statement.command not in self.excludeFromHistory: 339 if statement.command not in self.excludeFromHistory:
336 self.history.append(statement.fullStatement) 340 self.history.append(statement.fullStatement)
337 finally: 341 finally:
338 if statekeeper: 342 if statekeeper: