The following golang code catches CTRL+C when run from a DOS prompt, but when I run it from Cygwin it doesn't catch anything when CTRL+C is pressed.
What does Cygwin do when CTRL+C is pressed? My OS is Win7 64 bit running 32 bit Cygwin.
func main() {
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func(){
for sig := range c {
fmt.Println(sig.String())
}
}()
time.Sleep(5000 * time.Millisecond)
fmt.Println("Done")
}
go run
orgo build
followed bywhatever.exe
. Not sure if Cygwin has the same weirdness.ctrl c terminal cygwin
into Google I'll guess your cygwin is < 1.7.18.go run ...
Ctrl+c kills thego run
process but the go program runs to completion. When I do./signal.catcher.exe
the Ctrl+c kills the program (doesn't run to completion). The signals are not caught in either case.