mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
feat(util): Snacks.util.stop() to safely stop/close a luv handle
This commit is contained in:
parent
5589c9d355
commit
ce9e2993dd
1 changed files with 10 additions and 0 deletions
|
|
@ -468,6 +468,16 @@ function M.parse(parser, range, on_parse)
|
|||
end
|
||||
end
|
||||
|
||||
---@param handle? uv.uv_handle_t|uv.uv_timer_t
|
||||
function M.stop(handle)
|
||||
if handle and not handle:is_closing() then
|
||||
if handle.stop then
|
||||
handle:stop()
|
||||
end
|
||||
handle:close()
|
||||
end
|
||||
end
|
||||
|
||||
--- Better validation to check if path is a dir or a file
|
||||
---@param path string
|
||||
---@return "directory"|"file"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue