2

I have a small(ish) command-line application that talks to some custom hardware.

Right now, you run the executable, and it pops up a console window, and does it's thing. I'm handling SIGINT and SIGTERM so if you hit ctrl+c in the console window, it shuts down gracefully, and releases the custom hardware.

However, if kill the application by simply closing the console window (click the "x" in the corner), it seems to basically be immediately killed, with no time to do any cleanup.

I'd like to be able to do my shutdown procedures if the console is closed. I've not had much luck trying to find out what, exactly, is even happening to my process when it's console is closed.

Fake Name
  • 5,556
  • 5
  • 44
  • 66

1 Answers1

0

And as soon as I ask the question, I find Gracefully terminate a Boost Asio based Windows console application, which exactly answers it (I'm even using boost-asio!).

Fake Name
  • 5,556
  • 5
  • 44
  • 66