From 064ec734042af88e30cb2709143cbf5009232b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Mon, 1 Dec 2014 16:22:34 +0000 Subject: [PATCH] [INTERPRETER] * BUG: 'Exec ... To' and 'Shell ... To' work correctly again. git-svn-id: svn://localhost/gambas/trunk@6698 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- main/gbx/gbx_c_process.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/main/gbx/gbx_c_process.c b/main/gbx/gbx_c_process.c index d7f1408c2..3f728859d 100644 --- a/main/gbx/gbx_c_process.c +++ b/main/gbx/gbx_c_process.c @@ -162,10 +162,23 @@ static void callback_write(int fd, int type, CPROCESS *process) if (process->to_string) { - int n = read(fd, COMMON_buffer, 256); + int n; + + CSTREAM_stream(process)->common.has_read = FALSE; + + for(;;) + { + n = read(fd, COMMON_buffer, 256); + if (n >= 0 || errno != EINTR) + break; + } + if (n > 0) + { process->result = STRING_add(process->result, COMMON_buffer, n); - return; + CSTREAM_stream(process)->common.has_read = TRUE; + return; + } } if (GB_CanRaise(process, EVENT_Read))