From 51c462301b93eccbce6b9ed67675c8d26b998a7d Mon Sep 17 00:00:00 2001 From: Daniil Rozanov Date: Sat, 4 May 2024 01:41:56 +0300 Subject: fix: properly read for large number of targets in fileapi reply --- lua/cmake/utils.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lua/cmake/utils.lua') diff --git a/lua/cmake/utils.lua b/lua/cmake/utils.lua index 0c16658..ce6d213 100644 --- a/lua/cmake/utils.lua +++ b/lua/cmake/utils.lua @@ -56,6 +56,14 @@ function utils.read_file(path, callback) end) end +function utils.read_file_sync(path) + local fd = assert(vim.uv.fs_open(path, "r", 438)) + local stat = assert(vim.uv.fs_fstat(fd)) + local data = assert(vim.uv.fs_read(fd, stat.size, 0)) + assert(vim.uv.fs_close(fd)) + return data +end + function utils.write_file(path, txt, callback) uv.fs_open(path, "w", 438, function(err, fd) assert(not err, err) -- cgit v1.2.3