Do not make us guess what your code looks like and which packages you are
using. I'm guessing you are using
https://pkg.go.dev/golang.org/x/sys/unix#Select but I shouldn't have to do
so. You should be able to show us a minimal reproducible example of code
that illustrates a problem of this nature.

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%3DD8ogS89iB9G55X42yRQJ%2BVBhX75FVx9G%3Duta1feuK4rpQ%40mail.gmail.com.

Reply via email to