Hey folks,

I'm trying to figure out how to cancel reading from stdin programmatically. 
Basically the same way that ctrl+d works on OSX.

I would have thought this would work, but this program will just run 
forever:

package main


import (
 "io/ioutil"
 "os"
 "time"
)


func main() {
 go func() {
 time.Sleep(time.Second)
 println("closing...")
 os.Stdin.Close()
 }()

 _, _ = ioutil.ReadAll(os.Stdin)
 println("done")
}


Any help would be much appreciated – thanks!

-- 
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.

Reply via email to