aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshafouz <38974831+shafouz@users.noreply.github.com>2023-08-13 02:14:08 -0400
committerGitHub <noreply@github.com>2023-08-13 14:14:08 +0800
commit7b0123dd6a06a032516cce66d82c064b1d942013 (patch)
tree0416cc9eac98c5e62121d9d74f75de89b9589b5f
parente551d623d207685dafbfdf950477bad5b0fa876d (diff)
downloadrneovim-7b0123dd6a06a032516cce66d82c064b1d942013.tar.gz
rneovim-7b0123dd6a06a032516cce66d82c064b1d942013.tar.bz2
rneovim-7b0123dd6a06a032516cce66d82c064b1d942013.zip
feat(remote): avoid --remote-ui infinite loop (#24465)
-rw-r--r--src/nvim/main.c5
-rw-r--r--test/functional/core/startup_spec.lua13
2 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 377b804661..d9ca82784f 100644
--- 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
index fb30ddebb9..94ec3d4907 100644
--- 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()