cmd/tailscale/cli: restore SIGINT/SIGTERM on context cancel
This fixes Ctrl-C not interrupting "tailscale push". Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>pull/1696/head
parent
db5e269463
commit
d17f96b586
|
@ -126,7 +126,13 @@ func connect(ctx context.Context) (net.Conn, *ipn.BackendClient, context.Context
|
|||
go func() {
|
||||
interrupt := make(chan os.Signal, 1)
|
||||
signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-interrupt
|
||||
select {
|
||||
case <-interrupt:
|
||||
case <-ctx.Done():
|
||||
// Context canceled elsewhere.
|
||||
signal.Reset(syscall.SIGINT, syscall.SIGTERM)
|
||||
return
|
||||
}
|
||||
c.Close()
|
||||
cancel()
|
||||
}()
|
||||
|
|
Loading…
Reference in New Issue