diff --git a/cmd/dlv/cmds/commands.go b/cmd/dlv/cmds/commands.go index c5523694e5861274fd7aed81885279485988d1fc..3f2a2f1ae9db01f43bde59c43121198dc9a32058 100644 --- a/cmd/dlv/cmds/commands.go +++ b/cmd/dlv/cmds/commands.go @@ -690,14 +690,14 @@ func connectCmd(cmd *cobra.Command, args []string) { } // waitForDisconnectSignal is a blocking function that waits for either -// a SIGINT (Ctrl-C) signal from the OS or for disconnectChan to be closed -// by the server when the client disconnects. +// a SIGINT (Ctrl-C) or SIGTERM (kill -15) OS signal or for disconnectChan +// to be closed by the server when the client disconnects. // Note that in headless mode, the debugged process is foregrounded // (to have control of the tty for debugging interactive programs), // so SIGINT gets sent to the debuggee and not to delve. func waitForDisconnectSignal(disconnectChan chan struct{}) { ch := make(chan os.Signal, 1) - signal.Notify(ch, syscall.SIGINT) + signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) if runtime.GOOS == "windows" { // On windows Ctrl-C sent to inferior process is delivered // as SIGINT to delve. Ignore it instead of stopping the server