Closed linrongbin16 closed 1 year ago
I add some log, and it looks like that when fd
command exit, there maybe still some data not read to buffer, but I called the out_pipe:read_stop()
function in on_exit
function, which could stop reading.
So maybe I should just close the process handle in spawn's on_exit
(because it's just being invoked when the process exit).
Invoke read_stop
and close out_pipe
when data == nil
in read_start
callback (e.g. on_output
), this will ensure all data is read into buffer.
Let me try this solution when I am back to keyboard.
I finally make it working correctly! see this: https://github.com/linrongbin16/fzfx.nvim/pull/227
Hi,
I'm using
vim.loop.spawn
(e.g., the luv library) in Neovim v0.9.2 to develop a plugin, which supports Windows.I use the
spawn
API in this way:This is a sample code which is simple but mostly tells the basic structure of the logic.
But in this screen recording, you can see the print data is not consist. You can see that, during two
fd
searchings, the lines count is different: first is 1550, second is 1388.https://github.com/luvit/luv/assets/6496887/a52e96a5-ceae-46cc-a00a-d1bbb6361761
I guess the reason is that the timing of
on_exit
callback inspawn
3rd parameter comes, there's still some data not read into buffer.But is there an arrival order?