neovim/test/functional/provider
Justin M. Keyes 4fb48c5654
feat(server): set $NVIM, unset $NVIM_LISTEN_ADDRESS #11009
PROBLEM
------------------------------------------------------------------------
$NVIM_LISTEN_ADDRESS has conflicting purposes as both a parameter ("the
current process should listen on this address") and a descriptor ("the
current process is a child of this address").

This contradiction means the presence of NVIM_LISTEN_ADDRESS is
ambiguous, so child Nvim always tries to listen on its _parent's_
socket. This is the cause of lots of  "Failed to start server" spam in
our test/CI logs:

    WARN  2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-4480-0
    WARN  2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-2168-0

SOLUTION
------------------------------------------------------------------------

1. Set $NVIM to the parent v:servername, *only* in child processes.
   - Now the correct way to detect a "parent" Nvim is to check for $NVIM.
2. Do NOT set $NVIM_LISTEN_ADDRESS in child processes.
3. On startup if $NVIM_LISTEN_ADDRESS exists, unset it immediately after
   server init.
4. Open a channel to parent automatically, expose it as v:parent.

Fixes #3118
Fixes #6764
Fixes #9336
Ref https://github.com/neovim/neovim/pull/8247#issuecomment-380275696
Ref #8696
2022-05-03 06:08:35 -07:00
..
clipboard_spec.lua vim-patch:8.1.0999: use register one too often and not properly tested 2022-03-09 13:32:50 +08:00
define_spec.lua test, provider/define_spec.lua: fix few tests fail 2021-01-01 04:30:55 -05:00
nodejs_spec.lua feat(server): set $NVIM, unset $NVIM_LISTEN_ADDRESS #11009 2022-05-03 06:08:35 -07:00
perl_spec.lua feat(server): set $NVIM, unset $NVIM_LISTEN_ADDRESS #11009 2022-05-03 06:08:35 -07:00
provider_spec.lua [RFC] fix: has('python') error (#17252) 2022-01-31 15:06:46 +01:00
python3_spec.lua test(python3_spec): use a pattern to match SyntaxError message (#17705) 2022-03-13 22:05:56 +08:00
ruby_spec.lua refactor(tests): use assert_alive() #15546 2021-09-01 09:42:53 -07:00