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

Check if Unix domain socket is connectable before attaching

This commit is contained in:
Marco Hinz 2017-09-30 14:13:15 +02:00
parent d28c9c00bf
commit 282aa12fb4
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F
2 changed files with 7 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import neovim
import os
import psutil
import re
import socket
import stat
import subprocess
import sys
@ -61,8 +62,11 @@ class Neovim():
return True
address = self.address
if get_address_type(address) == 'socket':
if os.path.exists(address) and not stat.S_ISSOCK(os.stat(address).st_mode):
if get_address_type(address) == 'socket' and os.path.exists(address):
try:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect(address)
except:
with tempfile.NamedTemporaryFile(dir='/tmp', prefix='nvimsocket_') as f:
self.address = f.name

View File

@ -18,7 +18,7 @@ setup(
'console_scripts': ['nvr = nvr.nvr:main']
},
packages = ['nvr'],
version = '1.8.3',
version = '1.8.4',
license = 'MIT',
keywords = 'neovim nvim nvr remote helper',
classifiers = [