From c773fabeec3f58b2da0fbad558f6420795a1685e Mon Sep 17 00:00:00 2001 From: bhagwan Date: Thu, 2 Jan 2025 12:55:21 -0800 Subject: [PATCH] fix(libuv): potential race condition due to a553cfd Not sure if this can ever happen but this seems safer --- lua/fzf-lua/libuv.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/fzf-lua/libuv.lua b/lua/fzf-lua/libuv.lua index f0c07f71..688548ec 100644 --- a/lua/fzf-lua/libuv.lua +++ b/lua/fzf-lua/libuv.lua @@ -187,7 +187,7 @@ M.spawn = function(opts, fn_transform, fn_done) -- can fail with premature process kill -- assert(not err) finish(130, 0, 2, pid) - elseif write_cb_count == 0 and on_exit_called then + elseif write_cb_count == 0 and not output_pipe:is_active() and on_exit_called then -- spawn callback already called and did not close the pipe -- due to write_cb_count>0, since this is the last call -- we can close the fzf pipe