Skip to content

Running code on program termination #1783

Closed Answered by Lupus590
olliejohnson asked this question in Q&A
Discussion options

You must be logged in to vote

I would wrap my code in a call and watch for the terminated error message.
I think I have a code snippet for this somewhere, I'll have a look for it.

Edit: This snippet allows for tidy-up when main function errors. You can inspect the err message to see if it matches the terminated error message and thus do some special action on terminate.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by olliejohnson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants