]> git.e2factory.org Git - e2factory.git/commitdiff
e2lib: extend call_tool_argv to return exit code of tool
authorTobias Ulmer <tu@emlix.com>
Mon, 18 Feb 2019 18:23:47 +0000 (19:23 +0100)
committerTobias Ulmer <tu@emlix.com>
Mon, 18 Feb 2019 18:24:31 +0000 (19:24 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index a3b2edc9a487a38ab48ed9e91b706ff805096319..2f8ca1899000fb90c4c3be1d3b88b3a0a06414d6 100644 (file)
@@ -2477,8 +2477,9 @@ end
 -- @param workdir Working directory of tool (optional).
 -- @param envdict Environment dictionary of tool (optional).
 -- @param pty Allocate a PTY (optional).
--- @return True when the tool returned 0, false on error.
+-- @return True when the tool returned 0, false on error or ~= 0.
 -- @return Error object on failure.
+-- @return Exit status of the command (if any).
 -- @see callcmd_log
 function e2lib.call_tool_argv(tool, argv, workdir, envdict, pty)
     local rc, re, cmd, flags, call
@@ -2493,11 +2494,12 @@ function e2lib.call_tool_argv(tool, argv, workdir, envdict, pty)
     end
 
     rc, re = e2lib.callcmd_log(cmd, workdir, envdict, pty)
-    if not rc or rc ~= 0 then
+    if not rc then
         return false, re
+    elseif rc ~= 0 then
+        return false, re, rc
     end
-
-    return true
+    return true, nil, rc
 end
 
 --- Change permission mode of file.