In exec(), only add and remove pipe_{read,write} when necessary