]> git.e2factory.org Git - e2factory.git/commitdiff
e2lib: extend callcmd to skip call to wait for setting up pipes
authorTobias Ulmer <tu@emlix.com>
Mon, 2 Jan 2017 18:32:58 +0000 (19:32 +0100)
committerTobias Ulmer <tu@emlix.com>
Mon, 2 Jan 2017 18:32:58 +0000 (19:32 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index 92ea43007fe535a264707156cbcda5d9f9e8aa6d..80ac0c1670c5b0142bb9f84431a53c39242acac3 100644 (file)
@@ -1135,13 +1135,15 @@ end
 -- @param envdict Dictionary of (name, value) pairs to be added to the
 --                environment of the new process. Existing variables are
 --                overwritten.
+-- @param nowait Optional - if true, return the PID instead of calling wait() to
+--               get the return code.
 -- @return Return code of the child is returned. It's the callers responsibility
 --         to make sense of the value. If the return code is false, an error
 --         within the function occurred and an error object is returned
 -- @return Error object on failure.
 -- @see fdctv
 -- @see fdct
-function e2lib.callcmd(argv, fdctv, workdir, envdict)
+function e2lib.callcmd(argv, fdctv, workdir, envdict, nowait)
 
     -- To keep this large mess somewhat grokable, split into multiple functions.
 
@@ -1469,6 +1471,10 @@ function e2lib.callcmd(argv, fdctv, workdir, envdict)
         return false, re
     end
 
+    if nowait == true then
+        return pid
+    end
+
     e2lib.logf(3, "waiting for %q", table.concat(argv, " "))
     rc, re = e2lib.wait(pid)
     if not rc then