Perhaps the solution would be to reserve fd #1 and fd #2 by opening /dev/null a couple of times before creating the pipes? Not too sure on this one.
That's exactly what the short shell script fragment does, which I posted several days ago.
pgp00000.pgp
Description: PGP signature
