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: arnold
Subject: Re: fflush & close behavior not well-defined
Date: Fri, 02 Oct 2020 03:11:13 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Chet Ramey <chet.ramey@case.edu> wrote:

> 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.

Thanks for the input, Chet. It sounds like I need to just remove
that case from the test, since it's inherently racy.  I will try to
do that next week, when I have some vacation time.

Thanks!

Arnold



reply via email to

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