fix(vim.system): invalid MAX_TIMEOUT for 32-bit systems #31638

The maximum signed value on 32-bit systems is 2 ^ 31 - 1. When using 2 ^ 31 for
the default timeout, the value would overflow on such systems resulting in
a negative value, which caused a stack trace when calling wait() without
a timeout.
This commit is contained in:
Dan Pascu 2024-12-20 11:43:56 +02:00 committed by GitHub
parent 39781be14b
commit 4e130c1ee4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -79,7 +79,8 @@ function SystemObj:_timeout(signal)
self:kill(signal or SIG.TERM)
end
local MAX_TIMEOUT = 2 ^ 31
-- Use max 32-bit signed int value to avoid overflow on 32-bit systems. #31633
local MAX_TIMEOUT = 2 ^ 31 - 1
--- @param timeout? integer
--- @return vim.SystemCompleted