How about this: Set FD_CLOEXEC on all pipes just after creation, but clear the flag for the relevant pipes before exec?This doesn't help if other threads are randomly opening file descriptors. That is a problem I don't think we considered.
OK, but it will still solve the specific problem with the other end being open.