keplerproject/luacov — pull request #14 by moteus (2014-08-12 06:36:48+00:00)
Title: Change. Use `newproxy` gc method to call `on_exit` function.

Implementation with file has several bugs

* on windows temp directory could be pointed by TEMP or TMP env variable.
* gc method could not remove file because of this file still open
You could close file just after open it
```lua
runner.on_exit_trick = io.open(luacovlock, "w")
runner.on_exit_trick:close()
debug.setmetatable(runner.on_exit_trick, { __gc = on_exit } )
```
* If user code in Lua 5.2 calls `os.exit(true)` then on_exit function being called twice and raise error.