Re: Perl Quiz of the Week #23
Mark Jason Dominus <[email protected]>
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Message-ID | <[email protected]> |
Ron Isaacson <Ron.Isaacson-/PgpppG8B+R7qynMiXIxWgC/[email protected]>: > Mark Jason Dominus wrote: > > > > Mark Jason Dominus: > > > What's happening here is that 'head' exits after printing the first > > > ten lines, and this closes the pipe. balanced_gen continues running, > > > writing data into the pipe, until the pipe becomes full. > > > > Sorry, this is mistaken. balanced_gen receives the PIPE signal as > > soon as it tries to write to the closed pipe. > > Actually, I think the sigpipe happens whenever an attempt is made to > flush the output pipe. Pipes are not flushed. Buffers are flushed, and what this means is that the data in them is written to the pipe. The signal arrives when the process tries to write to the pipe, which occurs when it flushes the buffer. Until the buffer is flushed, no writing has occurred.