#NEWLINE# def admin( cmds , wait = False , **popen_kwargs ) : #NEWLINE# #INDENT# if ( not hdevtools_enabled ( ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# hdevtools_socket = get_setting_async ( 'hdevtools_socket' ) #NEWLINE# if hdevtools_socket : #NEWLINE# #INDENT# cmds . append ( '--socket={0}' . format ( hdevtools_socket ) ) #NEWLINE# #UNINDENT# command = ( [ 'hdevtools' , 'admin' ] + wait ) #NEWLINE# try : #NEWLINE# #INDENT# if wait : #NEWLINE# #INDENT# ( exit_code , stdout , stderr ) = call_and_wait ( command , ** popen_kwargs ) #NEWLINE# if ( exit_code == 0 ) : #NEWLINE# #INDENT# return stdout #NEWLINE# #UNINDENT# return '' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# call_no_wait ( command , ** popen_kwargs ) #NEWLINE# return '' #NEWLINE# #UNINDENT# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# if ( e . errno == errno . ENOENT ) : #NEWLINE# #INDENT# show_hdevtools_error_and_disable ( ) #NEWLINE# #UNINDENT# set_setting_async ( 'enable_hdevtools' , False ) #NEWLINE# return None #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# log ( 'calling to hdevtools fails with {0}' . format ( e ) ) #NEWLINE# return None