Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Anti-censorship
Pluggable Transports
Snowflake
Commits
f418ec7a
Commit
f418ec7a
authored
Jun 29, 2017
by
David Fifield
Browse files
Handle TOR_PT_EXIT_ON_STDIN_CLOSE.
parent
1fa9bc05
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/snowflake.go
View file @
f418ec7a
...
...
@@ -5,6 +5,7 @@ import (
"errors"
"flag"
"io"
"io/ioutil"
"log"
"net"
"os"
...
...
@@ -200,6 +201,16 @@ 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
)
log
.
Printf
(
"synthesizing SIGTERM because of stdin close"
)
sigChan
<-
syscall
.
SIGTERM
}()
}
// keep track of handlers and wait for a signal
sig
=
nil
for
sig
==
nil
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment