Skip to content

Commit

Permalink
red: fifo shell fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeping committed Oct 25, 2023
1 parent e2de808 commit 0343fff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions data/lib/red/proc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,17 @@ local function piped(w, out, prog)
end
local txt = w.buf:gettext(w.buf:range())
out:run(function()
while txt ~= '' do
while txt ~= '' and ret.fifo do
ret.fifo:write(txt:sub(1, 256))
txt = txt:sub(257)
coroutine.yield(true)
end
ret.fifo:close()
ret.fifo = nil
--[[
if ret.fifo then
ret.fifo:close()
ret.fifo = nil
end
]]--
end)
end

Expand Down
3 changes: 3 additions & 0 deletions data/lib/red/shell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ function shell.pipe(w, prog, inp, sh)
ret.fifo = nil
end
if not ret.stopped then
if tmp then
os.remove(tmp)
end
p:err("kill")
p:detach()
ret.stopped = true
Expand Down

0 comments on commit 0343fff

Please sign in to comment.