Example #1
0
def run_server(loop: AbstractEventLoop, root: str) -> None:
    socket_connection = add_socket_connection(loop, root)
    stdin_pipe_reader = loop.connect_read_pipe(
        lambda: AdapterProtocol(socket_connection, root), sys.stdin)
    loop.run_until_complete(stdin_pipe_reader)
    loop.set_exception_handler(error_handler)
    loop.run_forever()
Example #2
0
def start_and_run_server(loop: AbstractEventLoop, root: str) -> None:
    try:
        _start_server(root)
        run_server(loop, root)
    except Exception:
        # Run null server with warning to user that pyre server cannot be started.
        run_null_server(loop)
        Notifications.show_pyre_initialize_error(root)
        loop.run_forever()
Example #3
0
def run_server(loop: AbstractEventLoop, root: str) -> None:
    logging.basicConfig(
        filename=_get_log_file(root),
        level=logging.DEBUG,
        format="%(asctime)s %(message)s",
        datefmt="%m/%d/%Y %I:%M:%S %p",
        filemode="w",
    )
    logging.info("Starting adapter.")
    socket_connection = add_socket_connection(loop, root)
    stdin_pipe_reader = loop.connect_read_pipe(
        lambda: AdapterProtocol(socket_connection, root), sys.stdin)
    loop.run_until_complete(stdin_pipe_reader)
    loop.set_exception_handler(error_handler)
    loop.run_forever()
Example #4
0
def run_null_server(loop: AbstractEventLoop) -> None:
    stdin_pipe_reader = loop.connect_read_pipe(NullServerAdapterProtocol, sys.stdin)
    loop.run_until_complete(stdin_pipe_reader)
    loop.run_forever()