def admin(cmds, wait = False, **popen_kwargs):
    if not hdevtools_enabled():
        return None

    hdevtools_socket = get_setting_async('hdevtools_socket')

    if hdevtools_socket:
        cmds.append('--socket={0}'.format(hdevtools_socket))

    command = ["hdevtools", "admin"] + cmds

    try:
        if wait:
            (exit_code, stdout, stderr) = call_and_wait(command, **popen_kwargs)
            if exit_code == 0:
                return stdout
            return ''
        else:
            call_no_wait(command, **popen_kwargs)
            return ''

    except __HOLE__ as e:
        if e.errno == errno.ENOENT:
            show_hdevtools_error_and_disable()

        set_setting_async('enable_hdevtools', False)

        return None
    except Exception as e:
        log('calling to hdevtools fails with {0}'.format(e))
        return None
dataset/ETHPy150Open SublimeHaskell/SublimeHaskell/hdevtools.py/admin