NEXT:
+ * Fix doubled up error message on Control-C
* Fix e2factory sometimes ignoring Control-C
* Fix unintended modification of the git index in working source directory.
* Add sha256 support to e2source file config
return le2lib.setpgid(pid, pgid)
end
+--- Ignore SIGINT
+-- @raise error on failure
+function e2lib.ignore_sigint()
+ le2lib.ignore_sigint()
+end
+
--- Send signal to process.
-- @param pid Process ID to signal (number).
-- @param sig Signal number.
return 1;
}
+static int
+ignore_sigint(lua_State *L)
+{
+ if (signal(SIGINT, SIG_IGN) == SIG_ERR) {
+ return luaL_error(L, "signal: %s", strerror(errno));
+ }
+
+ return 0;
+}
+
static int
do_kill(lua_State *lua)
{
{ "fork", lua_fork },
{ "getpid", do_getpid },
{ "hardlink", do_hardlink },
+ { "ignore_sigint", ignore_sigint },
{ "kill", do_kill },
{ "mkdir", do_mkdir },
{ "mkdtemp", do_mkdtemp },
end
e2lib.log(3, "calling " .. e2call.tool)
-
- rc, re = e2lib.callcmd(cmd, {}, nil, env)
+ e2lib.ignore_sigint()
+ rc, re = e2lib.callcmd(cmd, {}, nil, env, true)
if not rc then
error(re)
end
+ local sig
+ rc, re, sig = e2lib.wait(rc)
+ if not rc then
+ error(re)
+ end
+
+ e2lib.logf(4, "%s returned: exit status: %d pid: %d signal: %d",
+ e2call.tool, rc, re, sig or 0)
return nil, rc
end