diff options
author | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-05-04 01:41:56 +0300 |
---|---|---|
committer | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-05-04 01:41:56 +0300 |
commit | 51c462301b93eccbce6b9ed67675c8d26b998a7d (patch) | |
tree | c74632386d3fc974c0d01a17eeb402a28c496873 /lua/cmake/utils.lua | |
parent | ac989fbbaad7a39b8cf075e165172a358c1620a1 (diff) |
fix: properly read for large number of targets in fileapi reply
Diffstat (limited to 'lua/cmake/utils.lua')
-rw-r--r-- | lua/cmake/utils.lua | 8 |
1 files changed, 8 insertions, 0 deletions
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) |