From 5488994b396f8975166da115f60a9f29cd3ac3ca Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Mon, 2 Jan 2017 19:32:58 +0100 Subject: [PATCH] e2lib: extend callcmd to skip call to wait for setting up pipes Signed-off-by: Tobias Ulmer --- generic/e2lib.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 92ea430..80ac0c1 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -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 -- 2.39.5