Compare commits

...

5 Commits

@ -56,14 +56,14 @@ class Nvr():
pass
def try_attach(self, args, nvr, options, arguments):
for i in range(10):
self.attach()
if self.server:
self.started_new_process = True
return main2(nvr, options, arguments)
time.sleep(0.2)
print(f'[!] Unable to attach to the new nvim process. Is `{" ".join(args)}` working?')
sys.exit(1)
for i in range(10):
self.attach()
if self.server:
self.started_new_process = True
return proceed_after_attach(nvr, options, arguments)
time.sleep(0.2)
print(f'[!] Unable to attach to the new nvim process. Is `{" ".join(args)}` working?')
sys.exit(1)
def execute_new_nvim_process(self, silent, nvr, options, arguments):
if not silent:
@ -73,14 +73,16 @@ class Nvr():
Use --nostart to avoid starting a new process.
'''))
arg0 = os.environ.get('NVR_CMD') or 'nvim'
args = os.environ.get('NVR_CMD')
args = args.split(' ') if args else ['nvim']
args.extend(['--listen', self.address])
multiprocessing.Process(target=self.try_attach, args=([arg0], nvr, options, arguments)).start()
multiprocessing.Process(target=self.try_attach, args=(args[0], nvr, options, arguments)).start()
try:
os.execvpe(arg0, [arg0, '--listen', self.address], os.environ)
os.execvpe(args[0], args, os.environ)
except FileNotFoundError:
print(f'[!] Can\'t start new nvim process: `{arg0}` is not in $PATH.')
print(f'[!] Can\'t start new nvim process: `{args[0]}` is not in $PATH.')
sys.exit(1)
def read_stdin_into_buffer(self, cmd):
@ -414,7 +416,10 @@ def main(argv=sys.argv, env=os.environ):
print_addresses()
return
address = options.servername or env.get('NVIM') or env.get('NVIM_LISTEN_ADDRESS') or '/tmp/nvimsocket'
address = options.servername or env.get('NVIM') or env.get('NVIM_LISTEN_ADDRESS')
if not address:
# Since before build 17063 windows doesn't support unix socket, we need another way
address = '127.0.0.1:6789' if os.name == 'nt' else '/tmp/nvimsocket'
nvr = Nvr(address, options.s)
nvr.attach()
@ -436,10 +441,10 @@ def main(argv=sys.argv, env=os.environ):
sys.exit(1)
nvr.execute_new_nvim_process(silent, nvr, options, arguments)
main2(nvr, options, arguments)
proceed_after_attach(nvr, options, arguments)
def main2(nvr, options, arguments):
def proceed_after_attach(nvr, options, arguments):
if options.d:
nvr.diffmode = True

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

Loading…
Cancel
Save