Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jan 2016 09:29:23 +0000
From:      Malcolm Matalka <mmatalka@gmail.com>
To:        Yuri <yuri@rawbw.com>
Cc:        "Montgomery-Smith\, Stephen" <stephen@missouri.edu>, "freebsd-hackers\@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: How to send EOF to the popen(3) pipe?
Message-ID:  <86bn8jme18.fsf@gmail.com>
In-Reply-To: <569A8508.80908@rawbw.com> (yuri@rawbw.com's message of "Sat, 16 Jan 2016 09:59:36 -0800")
References:  <5699BAC9.3060407@rawbw.com> <5699C8AB.7070006@missouri.edu> <569A8508.80908@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Yuri <yuri@rawbw.com> writes:

> On 01/15/2016 20:35, Montgomery-Smith, Stephen wrote:
>> Maybe I am displaying my ignorance.  But wouldn't you do this by
>> invoking the function pclose?
>
> No, pclose kills the process and returns the exit code. Half-closed connection though can be alive for a while, until the other side
> finishes and closes the pipe.

The manpage claims that pclose waits for the process to finish and
returns its exit code, is this not true?

"""
     The pclose() function waits for the associated process to terminate
     and
          returns the exit status of the command as returned by
     wait4(2).
"""

>
>> My memory of using this was that this could gridlock because of
>> buffering.  Suppose process A popens a process B.  A sends a message to
>
> Gridlocks are possible if reads/writes are performed in the wrong order. But this is besides the point of the original question.
>
> I think the answer to my question is "no". popen(3) can't send EOF. Protocol needs to support EOF signal on the application-level.
>
> Yuri
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86bn8jme18.fsf>