This repository was archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
This repository was archived by the owner on Jul 23, 2024. It is now read-only.
Support additional systems for UNIX domain sockets #58
Copy link
Copy link
Open
Description
With commit 5a20db1, UNIX domain sockets was introduced, yet it only supports Linux and MacOS (Darwin). Additional systems can easily be added. There are a few options, but I am not sure which is best. Here is what I am currently using:
diff --git a/pythonx/neovim_rpc_server.py b/pythonx/neovim_rpc_server.py
index d669fd0..055bbc0 100644
--- a/pythonx/neovim_rpc_server.py
+++ b/pythonx/neovim_rpc_server.py
@@ -296,7 +296,10 @@ class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
pass
-if sys.platform in ['linux', 'darwin']:
+# if sys.platform in ['freebsd11', 'linux', 'darwin']:
+# if platform.system() in ['Darwin', 'DragonFly', 'FreeBSD', 'Linux', 'NetBSD',
+# 'OpenBSD']:
+if os.name == 'posix':
class ThreadedUnixServer(socketserver.ThreadingMixIn,
socketserver.UnixStreamServer):
pass
The test for posix
is the most broad, but I do not know if it would include any systems that cannot handle it. While sys.platform
would work, it would grow fairly quickly since the BSD's all have the version of the OS appended to them. There is finally platform.system()
which is basically uname -s
which would work too and be easier than sys.platform
.
Another alternative is to try defining the class and handle the exception. It should work everywhere:
diff --git a/pythonx/neovim_rpc_server.py b/pythonx/neovim_rpc_server.py
index d669fd0..ca278c6 100644
--- a/pythonx/neovim_rpc_server.py
+++ b/pythonx/neovim_rpc_server.py
@@ -296,12 +296,12 @@ class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
pass
-if sys.platform in ['linux', 'darwin']:
+try:
class ThreadedUnixServer(socketserver.ThreadingMixIn,
socketserver.UnixStreamServer):
pass
has_unix = True
-else:
+except:
has_unix = False
Metadata
Metadata
Assignees
Labels
No labels