commit 7b0123dd6a06a032516cce66d82c064b1d942013
parent e551d623d207685dafbfdf950477bad5b0fa876d
Author: shafouz <38974831+shafouz@users.noreply.github.com>
Date: Sun, 13 Aug 2023 02:14:08 -0400
feat(remote): avoid --remote-ui infinite loop (#24465)
Diffstat:
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/nvim/main.c b/src/nvim/main.c
@@ -921,6 +921,11 @@ static void remote_request(mparm_T *params, int remote_args, char *server_addr,
os_errmsg(connect_error);
os_errmsg("\n");
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;
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
@@ -41,6 +41,19 @@ describe('startup', function()
ok(string.find(alter_slashes(meths.get_option_value('runtimepath', {})), funcs.stdpath('config'), 1, true) == nil)
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()
local testfile = 'Xtest_startuptime'
finally(function()