From 38b0fb7688450f51d5e811de77ffae121c05546f Mon Sep 17 00:00:00 2001 From: Peter Hodge Date: Tue, 3 Jul 2018 16:37:56 +1000 Subject: [PATCH] child_process_stream: split incoming chunks to reproduce bug --- nvim/child_process_stream.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nvim/child_process_stream.lua b/nvim/child_process_stream.lua index 5125a0e..db6dc1e 100644 --- a/nvim/child_process_stream.lua +++ b/nvim/child_process_stream.lua @@ -40,7 +40,19 @@ function ChildProcessStream:read_start(cb) if err then error(err) end - cb(chunk) + + -- Send the chunks through chars at a time. The read_start callback + -- should be happy to receive the data in chunks of any size as long as + -- they are in the correct order. + -- NOTE: sometimes this causes the functional tests to freeze up in weird + -- places, but also sometimes it causes a reproduction of the error seen on + -- OSX + local chunk_size = 8192 + local i = 1 + while i < #chunk do + cb(chunk:sub(i, i + chunk_size - 1)) + i = i + chunk_size + end end) end