Loading examples/dummy-client/dummy-client.go +10 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ package main import ( "io" "io/ioutil" "net" "os" "os/signal" Loading Loading @@ -116,6 +117,15 @@ func main() { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM) if os.Getenv("TOR_PT_EXIT_ON_STDIN_CLOSE") == "1" { // This environment variable means we should treat EOF on stdin // just like SIGTERM: https://bugs.torproject.org/15435. go func() { io.Copy(ioutil.Discard, os.Stdin) sigChan <- syscall.SIGTERM }() } // keep track of handlers and wait for a signal sig = nil for sig == nil { Loading examples/dummy-server/dummy-server.go +10 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ package main import ( "io" "io/ioutil" "net" "os" "os/signal" Loading Loading @@ -108,6 +109,15 @@ func main() { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM) if os.Getenv("TOR_PT_EXIT_ON_STDIN_CLOSE") == "1" { // This environment variable means we should treat EOF on stdin // just like SIGTERM: https://bugs.torproject.org/15435. go func() { io.Copy(ioutil.Discard, os.Stdin) sigChan <- syscall.SIGTERM }() } // keep track of handlers and wait for a signal sig = nil for sig == nil { Loading Loading
examples/dummy-client/dummy-client.go +10 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ package main import ( "io" "io/ioutil" "net" "os" "os/signal" Loading Loading @@ -116,6 +117,15 @@ func main() { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM) if os.Getenv("TOR_PT_EXIT_ON_STDIN_CLOSE") == "1" { // This environment variable means we should treat EOF on stdin // just like SIGTERM: https://bugs.torproject.org/15435. go func() { io.Copy(ioutil.Discard, os.Stdin) sigChan <- syscall.SIGTERM }() } // keep track of handlers and wait for a signal sig = nil for sig == nil { Loading
examples/dummy-server/dummy-server.go +10 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ package main import ( "io" "io/ioutil" "net" "os" "os/signal" Loading Loading @@ -108,6 +109,15 @@ func main() { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM) if os.Getenv("TOR_PT_EXIT_ON_STDIN_CLOSE") == "1" { // This environment variable means we should treat EOF on stdin // just like SIGTERM: https://bugs.torproject.org/15435. go func() { io.Copy(ioutil.Discard, os.Stdin) sigChan <- syscall.SIGTERM }() } // keep track of handlers and wait for a signal sig = nil for sig == nil { Loading