From 359471cc30cef54991a4f0b220579e77cf0ba993 Mon Sep 17 00:00:00 2001 From: gambas Date: Sat, 26 Aug 2017 13:11:59 +0200 Subject: [PATCH] Initialize master terminal of processes run inside a pseudo-terminal before forking. [INTEPRETER] * NEW: Initialize master terminal of processes run inside a pseudo-terminal before forking. --- main/gbx/gbx_c_process.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/main/gbx/gbx_c_process.c b/main/gbx/gbx_c_process.c index 6817e1820..c618d2295 100644 --- a/main/gbx/gbx_c_process.c +++ b/main/gbx/gbx_c_process.c @@ -603,6 +603,18 @@ static void run_process(CPROCESS *process, int mode, void *cmd, CARRAY *env) #ifdef DEBUG_ME fprintf(stderr, "run_process: slave = %s\n", slave); #endif + + if (mode & PM_TERM) + { + if (tcgetattr(fd_master, &termios_master)) + goto __ABORT_ERRNO; + + cfmakeraw(&termios_master); + //termios_master.c_lflag &= ~ECHO; + + if (tcsetattr(fd_master, TCSANOW, &termios_master)) + goto __ABORT_ERRNO; + } } else { @@ -653,18 +665,6 @@ static void run_process(CPROCESS *process, int mode, void *cmd, CARRAY *env) fprintf(stderr, "fork: pid = %d\n", pid); #endif - if (mode & PM_TERM) - { - if (tcgetattr(fd_master, &termios_master)) - goto __ABORT_ERRNO; - - cfmakeraw(&termios_master); - //termios_master.c_lflag &= ~ECHO; - - if (tcsetattr(fd_master, TCSANOW, &termios_master)) - goto __ABORT_ERRNO; - } - if (mode & PM_WRITE) { if (mode & PM_TERM)