home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!newsgate.watson.ibm.com!yktnews!admin!florida!essbaum
- From: essbaum@rchland.vnet.ibm.com (Alexander Essbaum)
- Subject: fork and STDOUT
- Sender: news@rchland.ibm.com
- Message-ID: <1992Dec30.223911.16297@rchland.ibm.com>
- Date: Wed, 30 Dec 1992 22:39:11 GMT
- Disclaimer: This posting represents the poster's views, not necessarily those of IBM
- Nntp-Posting-Host: florida.rchland.ibm.com
- Organization: IBM Rochester
- Lines: 29
-
- easy question (i hope):
-
- i'm doing
-
- if (!($pid = fork)) {
- open (cmd,"$cmd|"); # $cmd is a call to another perl script
- print <cmd>;
- exit 0;
- }
-
- the stuff returned in <cmd> (which comes from print "..."; and `...`; lines
- in $cmd) doesn't print properly. it seems to be getting buffered such that
- when $cmd exits, all of STDERR gets printed, then all of STDOUT. i've
- read the manual on open and i tried
-
- select(STDERR); $| = 1;
- select(STDOUT); $| = 1;
-
- in several places (both in the command called by $cmd and in the parent
- process). no dice. i don't really understand what's up with stuff like
-
- open (something,">&STDOUT");
-
- can someone explain exactly what this does (what is "duping"?) or maybe
- point me where to look (i checked the FAQ)?
-
- thanx!
-
- axel
-