Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work LState.Close() after os.Exit() #43

Closed
kohkimakimoto opened this issue Aug 20, 2015 · 0 comments
Closed

Does not work LState.Close() after os.Exit() #43

kohkimakimoto opened this issue Aug 20, 2015 · 0 comments
Labels

Comments

@kohkimakimoto
Copy link
Contributor

Hello yuin.

defer doesn't run when you use os.Exit() to terminate a process.
Therefore, LState.Close() doesn't run in some cases.

This behavior causes an issue. For instance. A temporary file that is created by io.tmpfile() is not deleted automatically by using glua. Please see the following steps.

Create test.lua

-- test.lua
local t = io.tmpfile()
t:write("This is a tempfile.")

Run the test.lua file by glua.

glua test.lua

Look for the file. At my environment(OSX 10.10.4), the temporary file generated under the /var/folders/bt/xwh9qmcj00dctz53_rxclgtr0000gn/T. It is not deleted.

ls -ltr /var/folders/bt/xwh9qmcj00dctz53_rxclgtr0000gn/T

...
-rw-------   1 kohkimakimoto  staff       6  8 19 13:41 311400111
-rw-------   1 kohkimakimoto  staff       6  8 19 13:42 445911440
-rw-------   1 kohkimakimoto  staff       6  8 19 13:44 305149766
-rw-------   1 kohkimakimoto  staff       6  8 19 13:45 960108122
-rw-------   1 kohkimakimoto  staff       6  8 19 13:45 607108666
-rw-------   1 kohkimakimoto  staff       6  8 19 13:45 731094900
-rw-------   1 kohkimakimoto  staff       6  8 19 13:45 166451425
-rw-------   1 kohkimakimoto  staff       8  8 19 13:48 977724667
-rw-r--r--   1 kohkimakimoto  staff     132  8 19 18:53 lsuseractivityd.log
drwx------@  3 kohkimakimoto  staff     102  8 19 19:59 com.apple.mail
drwx------@  2 kohkimakimoto  staff      68  8 20 06:08 com.apple.corerecents.recentsd
-rw-------   1 kohkimakimoto  staff    4011  8 20 06:12 xcrun_db
drwxr-xr-x   2 kohkimakimoto  staff      68  8 20 06:24 TemporaryItems
-rw-------   1 kohkimakimoto  staff      19  8 20 07:39 440567778

cat 440567778
This is a tempfile.
yuin added a commit that referenced this issue Aug 20, 2015
@yuin yuin closed this as completed Aug 20, 2015
@yuin yuin added the bug label Aug 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants