diff options
| author | William Boman <william@redwill.se> | 2022-04-06 11:35:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-06 11:35:35 +0200 |
| commit | 0795a757e8b78116f7e6d9e353bcb0443c7dbc52 (patch) | |
| tree | 76f8d5d5eb55bb438db0de84a741b2d6b81fe073 /lua/nvim-lsp-installer/core/fs.lua | |
| parent | fix(pip3): always use normalized "python" executable with venv-enhanced path ... (diff) | |
| download | mason-0795a757e8b78116f7e6d9e353bcb0443c7dbc52.tar mason-0795a757e8b78116f7e6d9e353bcb0443c7dbc52.tar.gz mason-0795a757e8b78116f7e6d9e353bcb0443c7dbc52.tar.bz2 mason-0795a757e8b78116f7e6d9e353bcb0443c7dbc52.tar.lz mason-0795a757e8b78116f7e6d9e353bcb0443c7dbc52.tar.xz mason-0795a757e8b78116f7e6d9e353bcb0443c7dbc52.tar.zst mason-0795a757e8b78116f7e6d9e353bcb0443c7dbc52.zip | |
fix(r_language_server): run install script via stdin (#578)
Fixes #568.
Diffstat (limited to 'lua/nvim-lsp-installer/core/fs.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/core/fs.lua | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lua/nvim-lsp-installer/core/fs.lua b/lua/nvim-lsp-installer/core/fs.lua index 3819bd51..b915baf5 100644 --- a/lua/nvim-lsp-installer/core/fs.lua +++ b/lua/nvim-lsp-installer/core/fs.lua @@ -6,15 +6,6 @@ local M = {} ---@async ---@param path string ----@param contents string -function M.append_file(path, contents) - local fd = uv.fs_open(path, "a", 438) - uv.fs_write(fd, contents, -1) - uv.fs_close(fd) -end - ----@async ----@param path string function M.file_exists(path) local ok, fd = pcall(uv.fs_open, path, "r", 438) if not ok then @@ -81,11 +72,19 @@ end ---@async ---@param path string ---@param contents string -function M.write_file(path, contents) +---@param flags string @Defaults to "w". +function M.write_file(path, contents, flags) log.fmt_debug("fs: write_file %s", path) - local fd = assert(uv.fs_open(path, "w", 438)) + local fd = assert(uv.fs_open(path, flags or "w", 438)) uv.fs_write(fd, contents, -1) assert(uv.fs_close(fd)) end +---@async +---@param path string +---@param contents string +function M.append_file(path, contents) + M.write_file(path, contents, "a") +end + return M |
