2

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

Kirill
  • 6,762
  • 4
  • 51
  • 81

2 Answers2

4

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.

dlsniper
  • 7,188
  • 1
  • 35
  • 44
  • 1
    If so, why I don't see output after pressing Stop button here: `stop := make(chan os.Signal, 1)`; `signal.Notify(stop, syscall.SIGINT, syscall.SIGKILL)`; `s := <-stop`; `fmt.Printf("\nGot signal:", s)`; I see output only if I press `Ctrl+C` – Dedkov Vadim Jul 14 '22 at 09:29
0

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.

Haris Osmanagić
  • 1,249
  • 12
  • 28