natecraddock / workspaces.nvim

a simple plugin to manage workspace directories in neovim
MIT License
309 stars 15 forks source link

file.write missing fclose #37

Closed awoodx closed 2 months ago

awoodx commented 2 months ago

I noticed my nvim had a bunch of open file descriptors. I traced it to missing fclose in the util.file.write function.

-- write a string to a file (synchronous)
M.file.write = function(path, data)
    local fd = assert(uv.fs_open(path, "w", 438))
    assert(uv.fs_write(fd, data, 0))
end

I believe this function is missing the file close operation:

-- write a string to a file (synchronous)
M.file.write = function(path, data)
    local fd = assert(uv.fs_open(path, "w", 438))
    assert(uv.fs_write(fd, data, 0))
    assert(uv.fs_close(fd))
end
natecraddock commented 2 months ago

Good catch!