feat(terminal): when terminal terminates too quickly, don't close the window and show an error message. See #80

This commit is contained in:
Folke Lemaitre 2024-11-16 07:25:55 +01:00
parent ec9cfb36b1
commit 313954efdf
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -101,6 +101,10 @@ function M.open(cmd, opts)
once = true,
buffer = terminal.buf,
callback = function()
if type(vim.v.event) == "table" and vim.v.event.status ~= 0 then
Snacks.notify.error("Terminal exited with code " .. vim.v.event.status .. ".\nCheck for any errors.")
return
end
terminal:close()
vim.cmd.checktime()
end,