Guido van Rossum wrote:
How hard would it be to reimplement our own system() and popen() using only POSIX calls, for POSIX systems? I've always thought of these to be pretty simple combinations of fork() and exec(), with an assumption of a working /bin/sh.
I would be concerned that we bypass magic that the system vendor put into system(), which is essential for proper operation. For example, on Linux, system() blocks SIGINT in the parent process while the child is running. Also, the shell executable that system() uses may not be /bin/sh.
OTOH, using the same underlying implementation on all systems makes Python behave more predictable.
In the specific case, we would not even need pthread_atfork anymore, as we now could invoke PyOS_AfterFork in the child ourselves.