From a30e50008d2366a316b47c0c803489d654a9a461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Barcicki?= Date: Wed, 28 Jan 2026 11:05:16 +0100 Subject: [PATCH] [#85496] [HOTFIX] Split socket function --- sargraph.py | 2 +- watch.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sargraph.py b/sargraph.py index cec6e1c..71058a0 100755 --- a/sargraph.py +++ b/sargraph.py @@ -34,7 +34,7 @@ def send(session: str, message: str): if not file_exists(socket_path): fail(f"Session '{session}' does not exist") - sock = watch.get_bound_socket(socket_path) + sock = watch.get_socket() sock.connect(socket_path) sock.send(message.encode("utf-8")) sock.close() diff --git a/watch.py b/watch.py index 9529faf..4d6453b 100644 --- a/watch.py +++ b/watch.py @@ -104,8 +104,11 @@ def read_iface_stats(iface): def get_socket_path(session): return fr"\\.\pipe\sargraph-{session}" if is_windows() else f"/tmp/sargraph-{session}.sock" +def get_socket(): + return socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) + def get_bound_socket(sock_path): - sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) + sock = get_socket() sock.bind(sock_path) return sock