Skip to content

Commit b211d79

Browse files
committed
fix: use mainly vim.uv, vim.loop is fallback
Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com>
1 parent 3660999 commit b211d79

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lua/quicktest/module.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local api = vim.api
2+
local uv = vim.uv or vim.loop
23
local notify = require("quicktest.notify")
34
local a = require("plenary.async")
45
local u = require("plenary.async.util")
@@ -155,15 +156,15 @@ function M.run(adapter, params, config, opts)
155156
local printer = colorized_printer.new()
156157

157158
--- @type CmdJob
158-
local job = { id = math.random(10000000000000000), started_at = vim.uv.now(), status = "running" }
159+
local job = { id = math.random(10000000000000000), started_at = uv.now(), status = "running" }
159160
current_job = job
160161

161162
local is_running = function()
162163
return current_job and job.id == current_job.id and current_job.status == "running"
163164
end
164165

165166
local print_buf_status = function(buf, line_count)
166-
local passedTime = vim.loop.now() - job.started_at
167+
local passedTime = uv.now() - job.started_at
167168
if job.finished_at then
168169
passedTime = job.finished_at - job.started_at
169170
end
@@ -322,7 +323,7 @@ function M.run(adapter, params, config, opts)
322323

323324
if result.type == "exit" then
324325
job.exit_code = result.code
325-
job.finished_at = vim.uv.now()
326+
job.finished_at = uv.now()
326327
job.status = "finished"
327328

328329
if adapter.after_run then
@@ -486,7 +487,7 @@ function M.kill_current_run()
486487
vim.system({ "kill", tostring(current_job.pid) }):wait()
487488

488489
job.status = "canceled"
489-
job.finished_at = vim.uv.now()
490+
job.finished_at = uv.now()
490491
end
491492
end
492493

0 commit comments

Comments
 (0)