cmd/dlv: Don't stop headless server on SIGINT on windows (go-delve#1745) (#1746)
This allows to execute and debug signal handlers in inferior.
This commit is contained in:
parent
c902522a8c
commit
3c26681075
@ -675,10 +675,26 @@ func execute(attachPid int, processArgs []string, conf *config.Config, coreFile
|
|||||||
}
|
}
|
||||||
ch := make(chan os.Signal, 1)
|
ch := make(chan os.Signal, 1)
|
||||||
signal.Notify(ch, syscall.SIGINT)
|
signal.Notify(ch, syscall.SIGINT)
|
||||||
|
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
|
||||||
|
// in order to be able to debug signal handlers.
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-ch:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
select {
|
||||||
|
case <-disconnectChan:
|
||||||
|
}
|
||||||
|
} else {
|
||||||
select {
|
select {
|
||||||
case <-ch:
|
case <-ch:
|
||||||
case <-disconnectChan:
|
case <-disconnectChan:
|
||||||
}
|
}
|
||||||
|
}
|
||||||
err = server.Stop()
|
err = server.Stop()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user