Skip to content

Commit 822c3aa

Browse files
committed
Only start exponetial backoff when the process stdin is starved completely
1 parent 211a5af commit 822c3aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/developer-guide/using-libraries/child-processes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ local function write_data(proc, data)
211211
local written, errmsg = proc:write(data)
212212
local total_written = written or 0
213213

214-
while total_written < data_len and not errmsg do
214+
while written and not errmsg and total_written < data_len do
215215
written, errmsg = proc:write(data:sub(total_written + 1))
216216
total_written = total_written + (written or 0)
217217

218-
if (not written or written <= 0) and not errmsg and coroutine.running() then
218+
if written == 0 and not errmsg and coroutine.running() then
219219
-- with each consecutive fail the yield timeout is increased by 5ms
220220
coroutine.yield((failures * 5) / 1000)
221221

0 commit comments

Comments
 (0)