#NEWLINE# def main( argv = None ) : #NEWLINE# #INDENT# if ( argv is None ) : #NEWLINE# #INDENT# argv = sys . argv #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# args = vroom . args . Parse ( argv [ 1 : ] ) #NEWLINE# #UNINDENT# except ValueError as e : #NEWLINE# #INDENT# sys . stderr . write ( ( '%s\n' % ', ' . join ( e . args ) ) ) #NEWLINE# return 1 #NEWLINE# #UNINDENT# if args . murder : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# output = subprocess . check_output ( [ 'ps' , '-A' ] ) . decode ( 'utf-8' ) #NEWLINE# #UNINDENT# except subprocess . CalledProcessError : #NEWLINE# #INDENT# sys . stdout . write ( "Can't find running processes.\n" ) #NEWLINE# return 1 #NEWLINE# #UNINDENT# for line in output . splitlines ( ) : #NEWLINE# #INDENT# if line . endswith ( 'vroom' ) : #NEWLINE# #INDENT# pid = int ( line . split ( None , 1 ) [ 0 ] ) #NEWLINE# if ( pid != os . getpid ( ) ) : #NEWLINE# #INDENT# sys . stdout . write ( ( 'Killing a vroom: %s\n' % line ) ) #NEWLINE# os . kill ( pid , signal . SIGKILL ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# sys . stdout . write ( 'No running vrooms found.\n' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# end = 'VroomEnd()' #NEWLINE# kill = [ 'vim' , '--servername' , args . servername , '--remote-expr' , end ] #NEWLINE# sys . stdout . write ( "I hope you're happy.\n" ) #NEWLINE# return subprocess . call ( kill ) #NEWLINE# #UNINDENT# dirty = False #NEWLINE# writers = [ ] #NEWLINE# try : #NEWLINE# #INDENT# for filename in args . filenames : #NEWLINE# #INDENT# with open ( filename ) as f : #NEWLINE# #INDENT# runner = vroom . runner . Vroom ( filename , args ) #NEWLINE# writers . append ( runner ( f ) ) #NEWLINE# if runner . dirty : #NEWLINE# #INDENT# dirty = True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except vroom . vim . ServerQuit as e : #NEWLINE# #INDENT# sys . stderr . write ( 'Exception: {}\n' . format ( e ) ) #NEWLINE# return 2 #NEWLINE# #UNINDENT# if dirty : #NEWLINE# #INDENT# subprocess . call ( [ 'reset' ] ) #NEWLINE# #UNINDENT# for writer in writers : #NEWLINE# #INDENT# writer . Write ( ) #NEWLINE# #UNINDENT# vroom . output . WriteBackmatter ( writers , args ) #NEWLINE# failed_tests = [ w for w in writers if ( w . Status ( ) != vroom . output . STATUS . PASS ) ] #NEWLINE# if failed_tests : #NEWLINE# #INDENT# return 3