File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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' )
You can’t perform that action at this time.
0 commit comments