mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-22 17:01:43 +00:00
cmd/tailscaled: ignore SIGPIPE.
SIGPIPE can be generated when CLIs disconnect from tailscaled. This should not terminate the process. Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
d64de1ddf7
commit
9e26ffecf8
@ -149,9 +149,13 @@ func run() error {
|
|||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
// Exit gracefully by cancelling the ipnserver context in most common cases:
|
// Exit gracefully by cancelling the ipnserver context in most common cases:
|
||||||
// interrupted from the TTY or killed by a service manager.
|
// interrupted from the TTY or killed by a service manager.
|
||||||
|
interrupt := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||||
|
// SIGPIPE sometimes gets generated when CLIs disconnect from
|
||||||
|
// tailscaled. The default action is to terminate the process, we
|
||||||
|
// want to keep running.
|
||||||
|
signal.Ignore(syscall.SIGPIPE)
|
||||||
go func() {
|
go func() {
|
||||||
interrupt := make(chan os.Signal, 1)
|
|
||||||
signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
|
|
||||||
select {
|
select {
|
||||||
case s := <-interrupt:
|
case s := <-interrupt:
|
||||||
logf("tailscaled got signal %v; shutting down", s)
|
logf("tailscaled got signal %v; shutting down", s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user