How to send EOF to the popen(3) pipe?

Yuri yuri at rawbw.com
Sat Jan 16 17:59:37 UTC 2016


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.

> 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


More information about the freebsd-hackers mailing list