def call_hdevtools_and_wait(arg_list, filename = None, cabal = None):
    """
    Calls hdevtools with the given arguments.
    Shows a sublime error message if hdevtools is not available.
    """
    ghc_opts_args = get_ghc_opts_args(filename, cabal = cabal)
    hdevtools_socket = get_setting_async('hdevtools_socket')
    source_dir = get_source_dir(filename)

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

    try:
        exit_code, out, err = call_and_wait(['hdevtools'] + arg_list + ghc_opts_args, cwd = source_dir)

        if exit_code != 0:
            raise Exception("hdevtools exited with status %d and stderr: %s" % (exit_code, err))

        return crlf2lf(out)

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

        return None

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