It is also more likely, but not certain, that the bug is in your code rather than the macOS kernel or the https://pkg.go.dev/golang.org/x/sys/unix#Select Go code. Which is why it is important to actually show us the code you wrote. I've been programming for a living since 1979 and have written a lot of buggy code. I long ago learned to assume the mistake was on my end rather than the code I was relying on. That assumption is sometimes wrong but so infrequent as to be a rounding error compared to how often the mistake is mine.
On Fri, Dec 15, 2023 at 7:13 AM 'TheDiveO' via golang-nuts < golang-nuts@googlegroups.com> wrote: > 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 > <https://groups.google.com/d/msgid/golang-nuts/3f8df371-4fda-44e2-8acb-b0743fb6b27en%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- 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/CABx2%3DD_EM%3D7P9SAc9%2BJVaBofsGM%3D3PxOYwPbKkFy-fTf%2BiBTiQ%40mail.gmail.com.