From 45edeafa9eabf1f6303cd20096480fd86a251d5b Mon Sep 17 00:00:00 2001 From: Brandon Wiley Date: Thu, 9 Feb 2017 10:27:51 -0600 Subject: Implemented -exit-on-sdin-close flag --- common/termmon/termmon.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/termmon/termmon.go b/common/termmon/termmon.go index b95c77d..716bef6 100644 --- a/common/termmon/termmon.go +++ b/common/termmon/termmon.go @@ -104,7 +104,7 @@ func (m *TermMonitor) termOnPPIDChange(ppid int) { m.sigChan <- syscall.SIGTERM } -func NewTermMonitor() (m *TermMonitor) { +func NewTermMonitor(exitOnStdinClose bool) (m *TermMonitor) { ppid := os.Getppid() m = new(TermMonitor) m.sigChan = make(chan os.Signal) @@ -114,7 +114,7 @@ func NewTermMonitor() (m *TermMonitor) { // If tor supports feature #15435, we can use Stdin being closed as an // indication that tor has died, or wants the PT to shutdown for any // reason. - if pt_extras.PtShouldExitOnStdinClose() { + if exitOnStdinClose || pt_extras.PtShouldExitOnStdinClose() { go m.termOnStdinClose() } else { // Instead of feature #15435, use various kludges and hacks: -- cgit v1.2.3