Beispiel #1
0
def create_listener():
    addr = viewer_socket_address()
    if islinux:
        from calibre.utils.ipc.server import LinuxListener as Listener
    else:
        from multiprocessing.connection import Listener
        if not iswindows:
            # On macOS (and BSDs, I am guessing), following a crash, the
            # listener socket file sticks around and needs to be explicitly
            # removed. It is safe to do this since we are already guaranteed to
            # be the owner of the socket by singleinstance()
            try:
                os.remove(addr)
            except Exception:
                pass
    return Listener(address=addr)
Beispiel #2
0
def create_listener():
    if islinux:
        from calibre.utils.ipc.server import LinuxListener as Listener
    else:
        from multiprocessing.connection import Listener
    return Listener(address=viewer_socket_address())