The library functions popen(3) and system(3) are used to create a new shell process and (in case of popen(3) set up IPC channels to the new process).

Currently they are implemented using fork(2), execve(2) and do a bit of astonishing complex internal bookkeeping.

It should be possible to simplify both implementations using posix_spawn(3) and associated helper functions.

Add a comment