How to send custom signal to kill running process with Goland?

2.4k Views Asked by At

When I run/debug Ginkgo test from Intellij Idea (with Go plugin installed), it does not shut down gracefully if I press "Stop" button.

enter image description here

JustBeforeEach and AfterEach functions do not get executed and process stops immediately. When I run test from console it gracefully shuts down if I press Ctrl+C. How can I make Intellij Idea/Goland to send custom signal in order to stop running process?

My gotest options are: -ginkgo.v -ginkgo.progress -ginkgo.trace -ginkgo.focus=MyTest

2

There are 2 best solutions below

1
On

GoLand sends a SIGINT then follows with a SIGKILL to terminate the process. You should make your application handle either of those signals before exiting.

0
On

On a Linux/Unix OS, you can use the kill command. For example, if you want to send an interrupt signal, you would use kill -2 pid.