Re: [Rd] system/system2 and open file descriptors

2017-04-20 Thread William Dunlap via R-devel
In S+ on Unix-alikes we dealt with this issue by using fcntl(fd, F_SETFD, 1) to set the close-on-exec flag on a file descriptor as soon as we opened it. Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Apr 19, 2017 at 8:40 PM, Winston Chang wrote: > In addition to

Re: [Rd] system/system2 and open file descriptors

2017-04-19 Thread Winston Chang
In addition to the issue of a child process holding onto open files, the child process can also manipulate a file descriptor in a way that affects the parent process. For example, calling lseek() in the child process will move the file offset in the parent process. Here is a set of commands that

[Rd] system/system2 and open file descriptors

2017-04-18 Thread Winston Chang
It seems that the system() and system2() functions don't close file descriptors between the fork() and exec() (on Unix platforms, of course). This means that the child processes inherit open files and socket connections. Running this (from a terminal) will result in the child process writing to a