feat(remote): avoid --remote-ui infinite loop (#24465)

This commit is contained in:
shafouz 2023-08-13 02:14:08 -04:00 committed by GitHub
parent e551d623d2
commit 7b0123dd6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -921,6 +921,11 @@ static void remote_request(mparm_T *params, int remote_args, char *server_addr,
os_errmsg(connect_error); os_errmsg(connect_error);
os_errmsg("\n"); os_errmsg("\n");
os_exit(1); os_exit(1);
} else if (strequal(server_addr, os_getenv("NVIM"))) {
os_errmsg("Cannot attach UI of :terminal child to its parent. ");
os_errmsg("(Unset $NVIM to skip this check)");
os_errmsg("\n");
os_exit(1);
} }
ui_client_channel_id = chan; ui_client_channel_id = chan;

View File

@ -41,6 +41,19 @@ describe('startup', function()
ok(string.find(alter_slashes(meths.get_option_value('runtimepath', {})), funcs.stdpath('config'), 1, true) == nil) ok(string.find(alter_slashes(meths.get_option_value('runtimepath', {})), funcs.stdpath('config'), 1, true) == nil)
end) end)
it('prevents remote UI infinite loop', function()
clear()
local screen
screen = Screen.new(84, 3)
screen:attach()
funcs.termopen({ nvim_prog, '-u', 'NONE', '--server', eval('v:servername'), '--remote-ui' })
screen:expect([[
^Cannot attach UI of :terminal child to its parent. (Unset $NVIM to skip this check) |
|
|
]])
end)
it('--startuptime', function() it('--startuptime', function()
local testfile = 'Xtest_startuptime' local testfile = 'Xtest_startuptime'
finally(function() finally(function()