Does it get executed only once? What happens after that? Does the application exit? May be there is some code to exit the app inside functionMain? Just check.