I\'ve been trying to work out how a console program can be notified that it is being terminated, and gracefully handle it.
This seems pretty straight forward for most