Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lua/diffview/job.lua
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,21 @@ function Job:sync(timeout)
if not ok then
if status == -1 then
self:kill(-1)
-- Give SIGTERM a bounded window to reap the subprocess before
-- surrendering, so a timed-out job does not leave a child that
-- outlives this Neovim. If the direct child ignores SIGTERM, fall
-- back to SIGKILL. Grandchildren (`sh -c "...sleep..."` and the like)
-- are reparented past us regardless; this cleans up the common case.
if not vim.wait(500, function()
return self:is_done()
end, 10) then
if self.handle and not self.handle:is_closing() then
pcall(self.handle.kill, self.handle, "sigkill")
end
vim.wait(500, function()
return self:is_done()
end, 10)
end
return false, "Synchronous job timed out!"
elseif status == -2 then
return false, "Synchronous job got interrupted!"
Expand Down
Loading