You should try
which does a dup2 to copy the handle $c to the STDIN. This way filehandle 0 of perl (the real stdin in the eyes of unix, not only the STDIN glob of perl) will be associated to perl. Stdin normally has the FD_CLOEXEC flag unset, so it will be passed to the child process.open STDIN, "<&", $c;
If you don't have to use stdin only pass a filehandle, you can do this: Clear the FD_CLOEXEC flag like
so that it will be passed to the child. Than somehow tell the number fileno($c) to the child process and the child can read from that filehandle.fcntl $c, F_GETFD, 0; fcntl $c, F_SETFD, $x&~FD_CLOEXEC;
Update: Does this post make sense? The whole point is, you should write open STDIN, "<&", $c; instead of *STDIN = $c; because the latter affects only perl's idea of stdin.
In reply to Re: Problem with passing my script's STDIN to child
by ambrus
in thread Problem with passing my script's STDIN to child
by suaveant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |