2
0
mirror of https://github.com/mhinz/neovim-remote synced 2024-11-11 13:10:34 +00:00

Improve check for IPv4 address

If the address contains only one colon followed by a number, assume TCPv4 and
a Unix domain otherwise.

Closes #60.
This commit is contained in:
Marco Hinz 2017-09-29 17:20:20 +02:00
parent dac335752a
commit ec612dc16c
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

View File

@ -46,8 +46,11 @@ class Neovim():
def attach(self):
try:
if ':' in self.address:
ip, port = self.address.split(':')
self.server = neovim.attach('tcp', address=ip, port=int(port))
ip, port = self.address.split(':', 1)
if port.isdigit():
self.server = neovim.attach('tcp', address=ip, port=int(port))
else:
self.server = neovim.attach('socket', path=self.address)
else:
self.server = neovim.attach('socket', path=self.address)
except OSError: