Hi, I need to detect on the producer side (writing end) of a named pipe 
when the consumer (reading end) has disconnect/closed. This detection needs 
to work "quickly" even if the producer doesn't produce anything; thus, 
SIGPIPE wouldn't help.

On Linux, when using unix.Select() on the fd of the producer's writing end 
of the named pipe, the fd becomes readable only upon the consumer 
disconnecting.

On macos, unix.Select indicates that the writing end fd becomes readable as 
soon as the producer writes(!) data. But it never reports the fd becoming 
readable upon the consumer disconnecting.

I'm opening both named pipe ends as follows (in different processes):

os.OpenFile(fifoname, os.O_WRONLY, os.ModeNamedPipe)
os.OpenFile(fifoname, os.O_RDONLY, os.ModeNamedPipe)

   - is there something to know of in Go's runtime/stdlib (and especially 
   the poller) that might interfere with my usage of unix.Select on an 
   ordinary *os.File?
   - how can I detect the consumer disconnecting on macos?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3f8df371-4fda-44e2-8acb-b0743fb6b27en%40googlegroups.com.

Reply via email to