[Tarantool-patches] [PATCH 08/13] popen: unblock popen_read_timeout at a first byte

Alexander Turenko alexander.turenko at tarantool.org
Fri Apr 10 05:50:46 MSK 2020


Before this change popen_read_timeout() waits until a passed buffer will
be fully filled (or until EOF / timeout / IO error occurs). Now it waits
for any amount of data (but at least one byte).

It allows to communicate with an interactive child program: write, read,
repeat.

Part of #4031
---
 src/lib/core/popen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
index dbc700287..660ace0d5 100644
--- a/src/lib/core/popen.c
+++ b/src/lib/core/popen.c
@@ -345,8 +345,8 @@ popen_read_timeout(struct popen_handle *handle, void *buf,
 		  handle->pid, stdX_str(idx), idx, buf, count,
 		  handle->ios[idx].fd, timeout);
 
-	return coio_read_timeout(&handle->ios[idx], buf,
-				 count, timeout);
+	return coio_read_ahead_timeout(&handle->ios[idx], buf, 1, count,
+				       timeout);
 }
 
 /**
-- 
2.25.0



More information about the Tarantool-patches mailing list