scope(exit) and Ctrl-C
Adam D. Ruppe
destructionator at gmail.com
Sat Dec 2 01:26:14 UTC 2017
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.
More information about the Digitalmars-d-learn
mailing list