'What OS signal does the vscode-go debugger send to delve-dap when I terminate debugging
I want to capture the OS signal and do some exit jobs when I terminate the vscode golang debugger.
I have code as below:
sigalChan := make(chan os.Signal, 1)
signal.Notify(sigalChan, syscall.SIGINT, syscall.SIGTERM)
<-sigalChan
doSomeJobs()
but it doesn't work. Anyone can tell me how to figure it out? Maybe the signal type is not SIGINT or SIGTERM?
Solution 1:[1]
I find out a solution. Just set "console" to "integratedTerminal" in launch.json to make delve server foreground, then I can use "ctrl+c" to terminate the debugging process, and signal can be received in my program.
{
// launch.json
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/main.go",
"console": "integratedTerminal"
}
]
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | zengtao321 |
