Skip to content

Commit

Permalink
Check for value in stderr callback
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Mar 1, 2021
1 parent 9781324 commit cdf8e98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
15 changes: 11 additions & 4 deletions lua/gitsigns/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,18 @@ function M.run_diff(staged, text, diff_algo)
end
end
end,
on_stderr = function(_, line)
on_stderr = function(err, line)
if err then

vim.schedule(function()
print('error: ' .. err, 'NA', 'run_diff')
end)
elseif line then

vim.schedule(function()
print('error: ' .. line, 'NA', 'run_diff')
end)
vim.schedule(function()
print('error: ' .. line, 'NA', 'run_diff')
end)
end
end,
on_exit = function()
callback(results)
Expand Down
9 changes: 8 additions & 1 deletion teal/gitsigns/git.tl
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,18 @@ function M.run_diff(staged: string, text: {string}, diff_algo: string): cb_funct
end
end
end,
on_stderr = function(_, line: string)
on_stderr = function(err: string, line: string)
if err then
-- On windows print() crashes in callback threads
vim.schedule(function()
print('error: ' .. err, 'NA', 'run_diff')
end)
elseif line then
-- On windows print() crashes in callback threads
vim.schedule(function()
print('error: ' .. line, 'NA', 'run_diff')
end)
end
end,
on_exit = function()
callback(results)
Expand Down

0 comments on commit cdf8e98

Please sign in to comment.