Path: utzoo!attcan!uunet!fernwood!apple!sun-barr!rutgers!mcnc!sps From: sps@mcnc.org (Stephen Schaefer) Newsgroups: comp.lang.perl Subject: Wait for an output pipe? Message-ID: Date: 27 Sep 90 15:46:44 GMT Sender: daemon@mcnc.org Distribution: comp Organization: Microelectronics Center of North Carolina Lines: 40 My perl program is writing on a pipe that I opened: open(RMAINTNEED,"rmaintneed @ARGV|"; open(RDIST,"|rdist -f -"); while() { ...process...; print RDIST "rdist commands"; } However, when it is finished writing, it does not wait for the rdist to finish, but exits immediately, giving me my shell prompt, after which I start seeing progress reports from rdist. Before reading a lot of perl source code and seemingly irrelevant pieces of the manual, (if a simple answer is in the man page, it ought to be mentioned under open or wait, and it's not), I'd like someone to tell me: how do I wait for the output pipe to finish? Let me speculate: I shouldn't have to explicitly wait, but the ``wait'' that perl does on the output process was confused by the termination of the process from which I'm reading my input: open(RMAINTNEED,"rmaintneed @ARGV|"; open(RDIST,"|rdist -f -"); while() { ...process...; print RDIST "(rdist commands)"; } OK, I could collect the process ID from pipe open, but then how do I wait for that process? Wait is not documented as taking an optional argument. A wait without arguments at the end of the program has behaved as a no-op. I'm running on VAX 4.3BSD, and we do have wait3, although the installation script mutters at our lack of wait4 (wait4 what? :-). Thanks, -- Stephen P. Schaefer, Postmaster MCNC sps@mcnc.org P.O. Box 12889 ...!mcnc!sps RTP, NC 27709