I want to execute background processes at the same time from lua script
like:
a = io.popen("deploy.exp" .. ip1):read("*a") b = io.popen("deploy.exp" .. ip2):read("*a")
where a, b are constantly running processes. When I do this as above, b will only start after completion. And deploy.exp script is a wait script that was used for several ssh servers and executed some commands. Then I need to get some text from a and b. Any ideas on this? I tried ExtensionProposal API. When I tried, I got one error message: " * detected glibc free (): invalid next size (fast): 0x08aa2300 ** abort".
Part Code
for k,v in pairs(single) do command = k .. " 1 " .. table.concat(v, " ") local out = io.pipe() local pro = assert(os.spawn("./spaw.exp " .. command,{ stdout = out, })) if not proc then error("Failed to aprogrinate! "..tostring(err)) end print(string.rep("#", 50)) local exitcode = proc:wait() end
Does anyone have any experience (or advice / where we should look) with this? or give me a sample? Thanks
BTW: I tried luaposix, but I can not find any posix.fork () sample. Can anyone share this? Tks
source share