On Saturday, 2 December 2017 at 01:26:14 UTC, Adam D. Ruppe wrote:
On Saturday, 2 December 2017 at 00:41:19 UTC, Wanderer wrote:
I wonder why `scope(exit)` code is not executed when the program is terminated with Ctrl-C.

It depends on what your operating system is. On win32, I believe it does run. On Linux (and I think Mac) you need to set a signal handler to catch the ctrl c.

But this is intentional - there is no generic, reliable, cross-platform way of handling it natively. So you need to know the system and code it yourself. Not super hard but does take a bit of effort in your code.

On Windows 10 it does not run.
Thanks for the info, I dig around and truly there's no "general" way to do this.

Reply via email to