#NEWLINE# def run( self , input_ = None , output_ = None ) : #NEWLINE# #INDENT# '\n        Runs the current application\n\n        :param input_: An Input Instance\n        :type input_: cleo.input.Input\n        :param output_: An Output instance\n        :type output_: Output\n\n        :return: 0 if everything went fine, or an error code\n        :rtype: int\n        ' #NEWLINE# if ( input_ is None ) : #NEWLINE# #INDENT# input_ = ArgvInput ( ) #NEWLINE# #UNINDENT# if ( output_ is None ) : #NEWLINE# #INDENT# output_ = ConsoleOutput ( ) #NEWLINE# #UNINDENT# self . configure_io ( input_ , output_ ) #NEWLINE# try : #NEWLINE# #INDENT# status_code = self . do_run ( input_ , output_ ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# if ( not self . _catch_exceptions ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# if isinstance ( output_ , ConsoleOutput ) : #NEWLINE# #INDENT# self . render_exception ( e , output_ . get_error_output ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . render_exception ( e , output_ ) #NEWLINE# #UNINDENT# if isinstance ( e , CleoException ) : #NEWLINE# #INDENT# status_code = e . code #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# status_code = ( e . errno if hasattr ( e , 'errno' ) else 1 ) #NEWLINE# #UNINDENT# if ( status_code == 0 ) : #NEWLINE# #INDENT# status_code = 1 #NEWLINE# #UNINDENT# #UNINDENT# if self . _auto_exit : #NEWLINE# #INDENT# if ( status_code > 255 ) : #NEWLINE# #INDENT# status_code = 255 #NEWLINE# #UNINDENT# exit ( status_code ) #NEWLINE# #UNINDENT# return status_code