fix(trashFile): use non-async process & fix buffer deletion
parent
046a03a0a2
commit
7dabb8b0f5
|
|
@ -242,16 +242,15 @@ function M.trashFile(opts)
|
||||||
table.insert(trashArgs, oldFilePath)
|
table.insert(trashArgs, oldFilePath)
|
||||||
|
|
||||||
cmd("silent! update")
|
cmd("silent! update")
|
||||||
vim.system(trashArgs, { detach = true }, function(out)
|
local oldName = vim.fs.basename(oldFilePath)
|
||||||
local oldName = vim.fs.basename(oldFilePath)
|
local result = vim.system(trashArgs):wait()
|
||||||
if out.code == 0 then
|
if result.code == 0 then
|
||||||
u.bwipeout()
|
u.bwipeout()
|
||||||
u.notify(("%q deleted"):format(oldName))
|
u.notify(("%q deleted"):format(oldName))
|
||||||
else
|
else
|
||||||
local outmsg = out.stdout .. out.stderr
|
local outmsg = (result.stdout or "") .. (result.stderr or "")
|
||||||
u.notify(("Trashing %q failed: " .. outmsg):format(oldName), "error")
|
u.notify(("Trashing %q failed: " .. outmsg):format(oldName), "error")
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue