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?
exit
command so it can shut itself down. – Refined