#NEWLINE# def call_hdevtools_and_wait( arg_list , filename = None , cabal = None ) : #NEWLINE# #INDENT# '\n    Calls hdevtools with the given arguments.\n    Shows a sublime error message if hdevtools is not available.\n    ' #NEWLINE# ghc_opts_args = get_ghc_opts_args ( filename , cabal = cabal ) #NEWLINE# hdevtools_socket = get_setting_async ( 'hdevtools_socket' ) #NEWLINE# source_dir = get_source_dir ( filename ) #NEWLINE# if hdevtools_socket : #NEWLINE# #INDENT# arg_list . append ( '--socket={0}' . format ( hdevtools_socket ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( exit_code , out , err ) = call_and_wait ( ( ( [ 'hdevtools' ] + arg_list ) + ghc_opts_args ) , cwd = source_dir ) #NEWLINE# if ( exit_code != 0 ) : #NEWLINE# #INDENT# raise Exception ( ( 'hdevtools exited with status %d and stderr: %s' % ( exit_code , err ) ) ) #NEWLINE# #UNINDENT# return crlf2lf ( out ) #NEWLINE# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# if ( e . errno == errno . ENOENT ) : #NEWLINE# #INDENT# show_hdevtools_error_and_disable ( ) #NEWLINE# #UNINDENT# return None #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# log ( 'calling to hdevtools fails with {0}' . format ( e ) , log_error ) #NEWLINE# return None