[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Small question about os.exit and __gc
- From: Rob Kendrick <rjek@...>
- Date: Fri, 14 Mar 2014 13:31:08 +0000
On Fri, Mar 14, 2014 at 09:12:16AM -0400, Rena wrote:
> I also find it pretty odd that os.exit() doesn't close the state by
> default. That's just asking for cleanup handlers for objects to not get
> called, leaving things like temporary files and database connections laying
> around.
Except the OS will close any network connections that are open, and if
you did your temporary file right, it will be ephemeral and will also
vanish on exit.
On older versions of Lua, you can of course just try to iterate _G and
destroy everything (except the os table) before calling os.exit() if
you're concerned. (Bonus points for doing the same to the registry.)
B.