Skip to content

Commit 0aa219c

Browse files
committed
test: more sleep
1 parent a8d665f commit 0aa219c

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

tests/bootstrap.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,16 @@ for _, lang in ipairs(parsers) do
3535
end
3636
end
3737

38-
-- Verify the file exists
39-
if vim.fn.filereadable(parser_file) ~= 1 then
40-
error(string.format('%s parser installation completed but .so file not found at %s', lang, parser_file))
38+
-- pwait() can return before the file is fully written
39+
-- Poll for a short time to ensure the .so file exists
40+
local start = vim.loop.now()
41+
local file_wait_timeout = 5000 -- 5 seconds should be plenty
42+
while vim.fn.filereadable(parser_file) ~= 1 do
43+
if vim.loop.now() - start > file_wait_timeout then
44+
error(string.format('%s parser installation completed but .so file not found at %s after %ds',
45+
lang, parser_file, file_wait_timeout / 1000))
46+
end
47+
vim.wait(50)
4148
end
4249

4350
print(lang .. ' parser installed')

0 commit comments

Comments
 (0)