bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fflush & close behavior not well-defined


From: Chet Ramey
Subject: Re: fflush & close behavior not well-defined
Date: Thu, 1 Oct 2020 10:39:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

On 10/1/20 10:27 AM, arnold@skeeve.com wrote:

>> Does gawk read the output from `cat' or just send it straight to stdout?
>> And does it wait for the pipeline to terminate before running the close?
> 
> If gawk's close() is called then it closes the pipe, period. In the example
> code it wrote to the child but didn't read anything from it.

That's a potential race condition. If close runs before cat writes, or
finishes writing, then the cat process will get SIGPIPE and the shell's
exit status will reflect that.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]