bliss

KISS in Lua
git clone git://bvnf.space/bliss.git
Log | Files | Refs | README | LICENSE

commit 28414a36bcb2895de8385e6c2c090c2044be9d06
parent 39e11097112820eb2b8e42239545e9b28ecca056
Author: phoebos <ben@bvnf.space>
Date:   Mon, 11 Nov 2024 22:18:35 +0000

remove reference to __gc metatable, do trap_on

Diffstat:
Mbliss/install.lua | 1-
Mbliss/utils.lua | 7++-----
2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/bliss/install.lua b/bliss/install.lua @@ -84,7 +84,6 @@ local function install(env, arg) if not utils.run_quiet("cp", {"-fP", "./"..file, _tmp_file}) or not utils.run_quiet("mv", {"-f", _tmp_file, _file}) then -- run pkg_clean - --getmetatable(env.atexit).__gc() env.atexit() utils.log(pkgname, "Failed to install package", "ERROR") diff --git a/bliss/utils.lua b/bliss/utils.lua @@ -70,7 +70,7 @@ function setup() mkdirp(env.ROOT .. "/") mkdirp(env.src_dir, env.log_dir, env.bin_dir, env.mak_dir, env.pkg_dir, env.tar_dir, env.tmp_dir) - --trap_on(env) + local atexit = get_pkg_clean(env) env.atexit = atexit @@ -78,6 +78,7 @@ function setup() local o = os.exit os.exit = function(code, close) atexit(); o(code, true) end + trap_on(env) return env end @@ -126,9 +127,6 @@ end -- @treturn table env.atexit function trap_on(env) signal.signal(signal.SIGINT, function () os.exit(false) end) - -- use a finalizer to get pkg_clean to run on EXIT. A reference to atexit must - -- be kept for the whole duration of the program (should it be a global?) - --env.atexit = setmetatable({}, {__gc = get_pkg_clean(env)}) return env.atexit end @@ -136,7 +134,6 @@ end -- @tparam env env function trap_off(env) signal.signal(signal.SIGINT, signal.SIG_IGN) - --setmetatable(env.atexit, {}) end --- Split a string.