Commit e08d47dd authored by Benoît Minisini's avatar Benoît Minisini
Browse files

When using SHELL, call 'setpgrp()' after the possible 'setsid()' call....

When using SHELL, call 'setpgrp()' after the possible 'setsid()' call. Otherwise the shell i/o are not visible to the Gambas process.

[INTERPRETER]
* BUG: When using SHELL, call 'setpgrp()' after the possible 'setsid()' call. Otherwise the shell i/o are not visible to the Gambas process.
parent b6d39c70
Pipeline #334925850 passed with stage
in 24 minutes and 7 seconds
......@@ -525,8 +525,6 @@ static void run_process(CPROCESS *process, int mode, void *cmd, CARRAY *env)
// for virtual terminal
int fd_master = -1;
char *slave = NULL;
//struct termios termios_stdin;
//struct termios termios_check;
struct termios termios_master;
const char *exec;
......@@ -610,17 +608,14 @@ static void run_process(CPROCESS *process, int mode, void *cmd, CARRAY *env)
fprintf(stderr, "run_process: slave = %s\n", slave);
#endif
if (mode & PM_TERM)
{
if (tcgetattr(fd_master, &termios_master))
goto __ABORT_ERRNO;
if (tcgetattr(fd_master, &termios_master))
goto __ABORT_ERRNO;
cfmakeraw(&termios_master);
//termios_master.c_lflag &= ~ECHO;
cfmakeraw(&termios_master);
//termios_master.c_lflag &= ~ECHO;
if (tcsetattr(fd_master, TCSANOW, &termios_master))
goto __ABORT_ERRNO;
}
if (tcsetattr(fd_master, TCSANOW, &termios_master))
goto __ABORT_ERRNO;
}
else
{
......@@ -724,13 +719,8 @@ static void run_process(CPROCESS *process, int mode, void *cmd, CARRAY *env)
bool pwd;
int ch_i, ch_n;
//bool stdin_isatty = isatty(STDIN_FILENO);
sigprocmask(SIG_SETMASK, &old, NULL);
if (mode & PM_SHELL)
setpgid(0, 0);
if (mode & PM_TERM)
{
close(fd_master);
......@@ -797,6 +787,9 @@ static void run_process(CPROCESS *process, int mode, void *cmd, CARRAY *env)
}
}
if (mode & PM_SHELL)
setpgid(0, 0);
pwd = FALSE;
if (env)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment