On Saturday, June 25, 2016 at 11:31:57 AM UTC-4, Jessta wrote: > > You'll only get an EOF if the file descriptor has been closed, if it's > closed then you're not going to be able to read anything more anyway. > > What are you trying to do? >
I'm trying to write a replacement for svlogd from the runit suite for my own purposes, and as an exercise to learn Go. To that end, the logger must come up and wait on stdin for a service to begin writing to it. Initially there will not be one. Looking at the svlogd source, the author uses poll on stdin to block until a writer was available. I have tried to do this with select but once the writer comes up, select is returning immediately even if the service is not writing anything. func select_stdin() { var r_fdset syscall.FdSet for i := 0; i < 16; i++ { r_fdset.Bits[i] = 0 } r_fdset.Bits[0] = 1 _, selerr := syscall.Select(1, &r_fdset, nil, nil, nil) if selerr != nil { logger.Warning(selerr) } } I'm curious as to what I'm doing wrong with select here, and if it's possible to do this with a goroutine like you describe. Mike -- 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. For more options, visit https://groups.google.com/d/optout.