How to execute cleanup code on Ctrl-C (Break)?
Paul Dufresne
dufresnep at gmail.com
Sun Jul 8 09:57:17 PDT 2012
I am trying to translate some C++ code to D to learn D.
And the first lines to translate are:
signal(SIGINT, (sighandler_t) shutdownClient);
signal(SIGTERM, (sighandler_t) shutdownClient);
So I come to try:
import std.stdio;
void main(){
try {
while (true) writeln("H1!!");
} finally writeln("oh... Bye then!");
}
Using 2.059 dmd on Windows.
I expected the "ob... Bye then!" to show up on Ctrl-C, but it did
not:
H1!!
H1!!
H1!!
H1!!
^C
C:\Users\Paul\myd>
I have seens that there is std.signals but that does not really
seems related.
Help!
More information about the Digitalmars-d-learn
mailing list