Thanks for the great info! Out of curiosity, how is Go handling ctrl+d (sending EOF to stdin) right now? Is it part of the special case? A more generic way to ask this is:
Is it possible to programmatically tell os.Stdin that we've reached EOF while you're trying to read from it? On Friday, March 16, 2018 at 7:56:08 PM UTC+7, Ian Lance Taylor wrote: > > On Fri, Mar 16, 2018 at 5:29 AM, Alex Efros <powe...@powerman.name > <javascript:>> wrote: > > > > On Thu, Mar 15, 2018 at 12:49:15PM +0000, roger peppe wrote: > >> If it helps, you can set deadlines on *os.File now, as of Go 1.10: > >> > >> https://play.golang.org/p/h3Pg9Ql0CMB > >> > >> I don't see a way to cancel without deciding the deadline in advance > though. > > > > Why? What makes os.Stdin so special? > > > > If we add this at beginning of main() it'll work as expected: > > os.Stdin, _ = os.Open("/dev/stdin") > > What is special about os.Stdin is the way it is initialized, which is > to say it is normally in blocking mode, and therefore reads block even > if you close the descriptor in a different goroutine. This would be > affected by changes to https://golang.org/issue/22939. > > Ian > -- 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.