]> git.e2factory.org Git - e2factory.git/commitdiff
Fix error message, ignore SIGINT in parent
authorTobias Ulmer <tu@emlix.com>
Mon, 9 Jan 2017 18:40:59 +0000 (19:40 +0100)
committerTobias Ulmer <tu@emlix.com>
Mon, 9 Jan 2017 18:40:59 +0000 (19:40 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
Changelog
generic/e2lib.lua
generic/le2lib.c
global/e2.lua

index 1e73b7d80a80e19d3ab160db0a23c439eb375219..0e213fc3b1a422b4a8f2f08a6fc1192fd51b436a 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
 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
index 8f495a9c393464ba998c2162b028bca84d5ec663..d41cfdbb615b4e09f08e1eaac584e66f67f24494 100644 (file)
@@ -335,6 +335,12 @@ function e2lib.setpgid(pid, pgid)
     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.
index c65b0afa26d8bf0e84d3770e9d8c59245010ebfb..17431fd575212ccf490f1ea7e22253f1eb4c3fc5 100644 (file)
@@ -785,6 +785,16 @@ do_mkdir(lua_State *lua)
        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)
 {
@@ -945,6 +955,7 @@ static luaL_Reg lib[] = {
        { "fork", lua_fork },
        { "getpid", do_getpid },
        { "hardlink", do_hardlink },
+       { "ignore_sigint", ignore_sigint },
        { "kill", do_kill },
        { "mkdir", do_mkdir },
        { "mkdtemp", do_mkdtemp },
index 67bd144f55115cb33de6f75be0b272cfe14c9240..b6c119df1147ecba2c5e8682a14f51da29e0df38 100644 (file)
@@ -94,11 +94,19 @@ local function e2(arg)
     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