diff --git a/exit_unix.go b/exit_unix.go new file mode 100644 index 0000000..7a1b79d --- /dev/null +++ b/exit_unix.go @@ -0,0 +1,12 @@ +// +build linux darwin + +package main + +import ( + "syscall" + "os" +) + +func exit() { + syscall.Kill(syscall.Getpid(), syscall.SIGINT) +} diff --git a/exit_windows.go b/exit_windows.go new file mode 100644 index 0000000..c84a73d --- /dev/null +++ b/exit_windows.go @@ -0,0 +1,9 @@ +// +build windows + +package main + +import "os" + +func exit() { + os.Exit(0) +} diff --git a/main.go b/main.go index 4dafe40..a35292f 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,6 @@ import ( "net" "os" "os/signal" - "syscall" "time" _ "image/gif" @@ -84,7 +83,7 @@ func fill(ch chan<- *net.IPAddr, frames [][]*net.IPAddr, delay []time.Duration, for 0 != len(ch) { time.Sleep(1 * time.Second) } - syscall.Kill(syscall.Getpid(), syscall.SIGINT) + exit() return } // then wait on both