Skip to main content
10 votes

how to tell, from the outside, if the output stream of a process has been closed?

The stream isn’t closed; the fact that you are able to try writing to it without receiving an EBADF error is proof of that. (See man 2 write for details.) On Linux, given that you’re looking at a pipe,...
Stephen Kitt's user avatar
3 votes

how to tell, from the outside, if the output stream of a process has been closed?

Update: After re-reading your question, I see that you were asking about monitoring it externally. Using lsof or looking in /proc/$PID/fd/$FD for the pipe info and trying to find a matching pair ...
penguin359's user avatar
  • 12.4k

Only top scored, non community-wiki answers of a minimum length are eligible