kolide / launcher

Osquery launcher, autoupdater, and packager
https://kolide.com/launcher
Other
500 stars 99 forks source link

Wrap main and remove os.Exit calls so all deferred functions will execute #1693

Closed RebeccaMahany closed 2 months ago

RebeccaMahany commented 2 months ago

Relates to https://github.com/kolide/launcher/pull/1692

When we call os.Exit, deferred functions will not execute, which means e.g. the event log writer on windows won't get closed. For a more graceful shutdown, we wrap main as runMain and disallow os.Exit calls outside of the new main.