Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I write an exit handler for an F# application?

Subject says it all.

I want some code to run if my application is terminated by, say, ^C.

like image 304
Paul Steckler Avatar asked Jul 30 '10 04:07

Paul Steckler


1 Answers

Use AppDomain.ProcessExit (http://msdn.microsoft.com/en-us/library/system.appdomain.processexit.aspx):

System.AppDomain.CurrentDomain.ProcessExit.Add(fun _ -> ...)
like image 134
Dmitry Lomov Avatar answered Sep 22 '22 03:09

Dmitry Lomov