in reply to Problem with passing my script's STDIN to child
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem with passing my script's STDIN to child
by suaveant (Parson) on Aug 23, 2004 at 15:37 UTC | |
|
Re^2: Problem with passing my script's STDIN to child
by amw1 (Friar) on Aug 21, 2004 at 18:09 UTC | |
by ambrus (Abbot) on Aug 21, 2004 at 19:08 UTC |