Skip to content

Commit

Permalink
fix: `wait()‘ without timeout on 32bit (closes #1599)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Dec 19, 2024
1 parent cd9ab4e commit 29e8180
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/fzf-lua/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1105,12 +1105,16 @@ function M.keymap_set(mode, lhs, rhs, opts)
end
end

-- Taken from `runtime/lua/vim/_system.lua`
-- will raise exception without timeout on 32-bit systems (#1599)
local MAX_TIMEOUT = 2 ^ 31

---@param cmd string[]
---@return string[] lines in the stdout or stderr, separated by '\n'
---@return integer exit_code (0: success)
function M.io_systemlist(cmd)
if vim.system ~= nil then -- nvim 0.10+
local proc = vim.system(cmd):wait()
local proc = vim.system(cmd):wait(MAX_TIMEOUT)
local output = (type(proc.stderr) == "string" and proc.stderr or "")
.. (type(proc.stdout) == "string" and proc.stdout or "")
return vim.split(output, "\n", { trimempty = true }), proc.code
Expand All @@ -1124,7 +1128,7 @@ end
---@return integer exit_code (0: success)
function M.io_system(cmd)
if vim.system ~= nil then -- nvim 0.10+
local proc = vim.system(cmd):wait()
local proc = vim.system(cmd):wait(MAX_TIMEOUT)
local output = (type(proc.stderr) == "string" and proc.stderr or "")
.. (type(proc.stdout) == "string" and proc.stdout or "")
return output, proc.code
Expand Down

0 comments on commit 29e8180

Please sign in to comment.