fix: add separate timeout for instalelr (#109)
* fix(installer): add separate timeout for installer
This commit is contained in:
parent
ea28fc4e6f
commit
9d28cdebf1
4 changed files with 19 additions and 5 deletions
|
|
@ -57,6 +57,9 @@ to install them synchronously pass `{sync = true}` as an argument.
|
||||||
---@type number
|
---@type number
|
||||||
timeout = 2000,
|
timeout = 2000,
|
||||||
|
|
||||||
|
--- timeout for running installer commands(e.g :GoDepsInstall, :GoDepsInstallSync)
|
||||||
|
installer_timeout = 999999,
|
||||||
|
|
||||||
-- user specified paths to binaries
|
-- user specified paths to binaries
|
||||||
---@class gopher.ConfigCommand
|
---@class gopher.ConfigCommand
|
||||||
commands = {
|
commands = {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ local log = require "gopher._utils.log"
|
||||||
local utils = {}
|
local utils = {}
|
||||||
|
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@param lvl? number
|
---@param lvl? number by default `vim.log.levels.INFO`
|
||||||
function utils.notify(msg, lvl)
|
function utils.notify(msg, lvl)
|
||||||
lvl = lvl or vim.log.levels.INFO
|
lvl = lvl or vim.log.levels.INFO
|
||||||
vim.notify(msg, lvl, {
|
vim.notify(msg, lvl, {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@ local default_config = {
|
||||||
---@type number
|
---@type number
|
||||||
timeout = 2000,
|
timeout = 2000,
|
||||||
|
|
||||||
|
--- timeout for running installer commands(e.g :GoDepsInstall, :GoDepsInstallSync)
|
||||||
|
installer_timeout = 999999,
|
||||||
|
|
||||||
-- user specified paths to binaries
|
-- user specified paths to binaries
|
||||||
---@class gopher.ConfigCommand
|
---@class gopher.ConfigCommand
|
||||||
commands = {
|
commands = {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
local c = require("gopher.config").commands
|
local c = require "gopher.config"
|
||||||
local r = require "gopher._utils.runner"
|
local r = require "gopher._utils.runner"
|
||||||
local u = require "gopher._utils"
|
local u = require "gopher._utils"
|
||||||
local log = require "gopher._utils.log"
|
local log = require "gopher._utils.log"
|
||||||
|
|
@ -30,14 +30,22 @@ end
|
||||||
|
|
||||||
---@param url string
|
---@param url string
|
||||||
local function install(url)
|
local function install(url)
|
||||||
r.async({ c.go, "install", url }, function(opt)
|
vim.schedule(function()
|
||||||
handle_intall_exit(opt, url)
|
u.notify("go install-ing: " .. url)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
r.async({ c.commands.go, "install", url }, function(opt)
|
||||||
|
handle_intall_exit(opt, url)
|
||||||
|
end, { timeout = c.installer_timeout })
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param url string
|
---@param url string
|
||||||
local function install_sync(url)
|
local function install_sync(url)
|
||||||
local rs = r.sync { c.go, "install", url }
|
vim.schedule(function()
|
||||||
|
u.notify("go install-ing: " .. url)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local rs = r.sync({ c.commands.go, "install", url }, { timeout = c.installer_timeout })
|
||||||
handle_intall_exit(rs, url)
|
handle_intall_exit(rs, url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue