"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "main/gbx/gbx_c_process.c" between
gambas-3.16.2.tar.bz2 and gambas-3.16.3.tar.bz2

About: Gambas is a graphical development environment based on a Basic interpreter with object extensions, a bit like Visual Basic (requires Qt).

gbx_c_process.c  (gambas-3.16.2.tar.bz2):gbx_c_process.c  (gambas-3.16.3.tar.bz2)
skipping to change at line 524 skipping to change at line 524
pid_t pid; pid_t pid;
char **argv; char **argv;
CARRAY *array; CARRAY *array;
int i, n; int i, n;
sigset_t sig, old; sigset_t sig, old;
int save_errno; int save_errno;
// for virtual terminal // for virtual terminal
int fd_master = -1; int fd_master = -1;
char *slave = NULL; char *slave = NULL;
//struct termios termios_stdin;
//struct termios termios_check;
struct termios termios_master; struct termios termios_master;
const char *exec; const char *exec;
if (mode & PM_SHELL) if (mode & PM_SHELL)
{ {
#ifdef DEBUG_ME #ifdef DEBUG_ME
fprintf(stderr, "run_process %p: %s\n", process, (char *)cmd); fprintf(stderr, "run_process %p: %s\n", process, (char *)cmd);
#endif #endif
argv = (char **)shell; argv = (char **)shell;
skipping to change at line 609 skipping to change at line 607
if (fd_master < 0) if (fd_master < 0)
goto __ABORT_ERRNO; goto __ABORT_ERRNO;
grantpt(fd_master); grantpt(fd_master);
unlockpt(fd_master); unlockpt(fd_master);
slave = ptsname(fd_master); slave = ptsname(fd_master);
#ifdef DEBUG_ME #ifdef DEBUG_ME
fprintf(stderr, "run_process: slave = %s\n", slave); fprintf(stderr, "run_process: slave = %s\n", slave);
#endif #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); cfmakeraw(&termios_master);
//termios_master.c_lflag &= ~ECHO; //termios_master.c_lflag &= ~ECHO;
if (tcsetattr(fd_master, TCSANOW, &termios_master)) if (tcsetattr(fd_master, TCSANOW, &termios_master))
goto __ABORT_ERRNO; goto __ABORT_ERRNO;
}
} }
else else
{ {
/* Create pipes */ /* Create pipes */
if ((mode & PM_WRITE) && pipe(fdin) != 0) if ((mode & PM_WRITE) && pipe(fdin) != 0)
goto __ABORT_ERRNO; goto __ABORT_ERRNO;
if ((mode & PM_READ) && (pipe(fdout) != 0 || pipe(fderr) != 0)) if ((mode & PM_READ) && (pipe(fdout) != 0 || pipe(fderr) != 0))
goto __ABORT_ERRNO; goto __ABORT_ERRNO;
skipping to change at line 723 skipping to change at line 718
} }
sigprocmask(SIG_SETMASK, &old, NULL); sigprocmask(SIG_SETMASK, &old, NULL);
} }
else //------------ child process ---------------------------- else //------------ child process ----------------------------
{ {
int fd_slave; int fd_slave;
bool pwd; bool pwd;
int ch_i, ch_n; int ch_i, ch_n;
//bool stdin_isatty = isatty(STDIN_FILENO);
sigprocmask(SIG_SETMASK, &old, NULL); sigprocmask(SIG_SETMASK, &old, NULL);
if (mode & PM_SHELL)
setpgid(0, 0);
if (mode & PM_TERM) if (mode & PM_TERM)
{ {
close(fd_master); close(fd_master);
setsid(); setsid();
fd_slave = open(slave, O_RDWR); fd_slave = open(slave, O_RDWR);
if (fd_slave < 0) if (fd_slave < 0)
abort_child(CHILD_CANNOT_OPEN_TTY); abort_child(CHILD_CANNOT_OPEN_TTY);
init_child_tty(fd_slave); init_child_tty(fd_slave);
skipping to change at line 796 skipping to change at line 786
{ {
close(fdout[0]); close(fdout[0]);
close(fderr[0]); close(fderr[0]);
if ((dup2(fdout[1], STDOUT_FILENO) == -1) if ((dup2(fdout[1], STDOUT_FILENO) == -1)
|| (dup2(fderr[1], STDERR_FILENO) == -1)) || (dup2(fderr[1], STDERR_FILENO) == -1))
abort_child(CHILD_CANNOT_PLUG_OUTPUT); abort_child(CHILD_CANNOT_PLUG_OUTPUT);
} }
} }
if (mode & PM_SHELL)
setpgid(0, 0);
pwd = FALSE; pwd = FALSE;
if (env) if (env)
{ {
char *str; char *str;
ch_n = ARRAY_count(env->data); ch_n = ARRAY_count(env->data);
for (ch_i = 0; ch_i < ch_n; ch_i++) for (ch_i = 0; ch_i < ch_n; ch_i++)
{ {
str = ((char **)env->data)[ch_i]; str = ((char **)env->data)[ch_i];
if (putenv(str)) if (putenv(str))
 End of changes. 7 change blocks. 
16 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)