mirror of
https://github.com/neovim/neovim.git
synced 2026-11-06 05:16:52 +00:00
test(harness): remove socket dir on exit #42658
Problem:
Each test run leaves its stdpath("run") dir, /tmp/nvim_<pid>, behind.
Solution:
Delete it when the runner exits.
AI-assisted
This commit is contained in:
1 parent
9213ffc7da
commit
6332ba64fe
1 file changed
+7
-2
+7
-2
@@ -32,6 +32,7 @@ if _G.arg[1] and vim.startswith(_G.arg[1], '-P') then
|
||||
vim.env.TMPDIR = build_dir .. '/Xtest_tmpdir'
|
||||
vim.fn.mkdir(vim.env.TMPDIR, 'p')
|
||||
end
|
||||
local run_dir --- @type string?
|
||||
if _G.arg[1] and vim.startswith(_G.arg[1], '-X') then
|
||||
local xdg_dir = string.sub(table.remove(_G.arg, 1), 3)
|
||||
vim.env.NVIM_RPLUGIN_MANIFEST = xdg_dir .. '/Xtest_rplugin_manifest'
|
||||
@@ -41,8 +42,9 @@ if _G.arg[1] and vim.startswith(_G.arg[1], '-X') then
|
||||
if vim.fn.has('win32') == 0 then
|
||||
-- Socket dir (stdpath("run")), deliberately NOT in the build dir. sockaddr_un.sun_path is 104
|
||||
-- bytes on macOS/BSD, "/…/build/tmp/nvim.<pid>.<n>" can exceed it. #38623
|
||||
vim.env.XDG_RUNTIME_DIR = ('/tmp/nvim_%d'):format(vim.uv.os_getpid())
|
||||
vim.fn.mkdir(vim.env.XDG_RUNTIME_DIR, 'p')
|
||||
run_dir = ('/tmp/nvim_%d'):format(vim.uv.os_getpid())
|
||||
vim.env.XDG_RUNTIME_DIR = run_dir
|
||||
vim.fn.mkdir(run_dir, 'p')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,6 +62,9 @@ if vim.v.servername ~= '' then
|
||||
end
|
||||
|
||||
local exit_code = require('test.harness').main(_G.arg)
|
||||
if run_dir then
|
||||
vim.fn.delete(run_dir, 'rf')
|
||||
end
|
||||
io.stdout:flush()
|
||||
io.stderr:flush()
|
||||
|
||||
|
||||
Reference in new issue
Block a user