style: better uv annotations

This commit is contained in:
Folke Lemaitre 2023-06-22 10:47:48 +02:00
parent ccd96bfa2e
commit 3867a81bb2
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@ local Config = require("lazy.core.config")
local M = {} local M = {}
---@type table<uv.uv_process_t, true> ---@type table<uv_process_t, true>
M.running = {} M.running = {}
M.signals = { M.signals = {
@ -75,10 +75,10 @@ function M.spawn(cmd, opts)
local stderr = assert(uv.new_pipe()) local stderr = assert(uv.new_pipe())
local output = "" local output = ""
---@type uv.uv_process_t ---@type uv_process_t?
local handle = nil local handle = nil
---@type uv.uv_timer_t ---@type uv_timer_t
local timeout local timeout
local killed = false local killed = false
if opts.timeout then if opts.timeout then
@ -96,6 +96,7 @@ function M.spawn(cmd, opts)
cwd = opts.cwd, cwd = opts.cwd,
env = env_flat, env = env_flat,
}, function(exit_code, signal) }, function(exit_code, signal)
---@cast handle uv_process_t
M.running[handle] = nil M.running[handle] = nil
if timeout then if timeout then
timeout:stop() timeout:stop()