commit 8611e7da4bd50d2849daeabe0013576117ae613e Author: David Fifield david@bamsoftware.com Date: Mon Apr 7 23:30:12 2014 -0700
Synthesize a SIGTERM on stdin close. --- meek-client-torbrowser/main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/meek-client-torbrowser/main.go b/meek-client-torbrowser/main.go index 8890f6d..c4989c3 100644 --- a/meek-client-torbrowser/main.go +++ b/meek-client-torbrowser/main.go @@ -141,6 +141,18 @@ func main() { } defer logKill(meekClientCmd.Process)
+ // On Windows, we don't get a SIGINT or SIGTERM, rather we are killed + // without a chance to clean up our subprocesses. When run inside + // processterminate-buffer, it is instead processterminate-buffer that + // is killed, and we can detect that event by that our stdout gets + // closed. + // https://trac.torproject.org/projects/tor/ticket/9330 + go func() { + io.Copy(ioutil.Discard, os.Stdin) + log.Printf("synthesizing SIGTERM because of stdin close") + sigChan <-syscall.SIGTERM + }() + sig := <-sigChan log.Printf("sig %s", sig) err = logSignal(meekClientCmd.Process, sig)