From 8ddd1f70e06f53e55eac6d45ec36fcfefa1ef08c Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Thu, 9 May 2019 16:35:37 +0200 Subject: [PATCH] git: fix git archive | tar pipe calling sequence Signed-off-by: Tobias Ulmer --- plugins/git.lua | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/plugins/git.lua b/plugins/git.lua index d501a0a..5d62da8 100644 --- a/plugins/git.lua +++ b/plugins/git.lua @@ -709,7 +709,7 @@ function git.git_source:prepare_source(sourceset, buildpath) end local gitdir, git_argv, git_tool, tar_argv - local pid, status, fdctv + local pid, status, git_fdctv, tar_fdctv local writeend, readend, devnull local children = {} @@ -770,29 +770,44 @@ function git.git_source:prepare_source(sourceset, buildpath) e2lib.log(3, "[git archive]: "..msg) end - fdctv = { + git_fdctv = { { istype = "readfo", dup = eio.STDIN, file = devnull }, { istype = "readfo", dup = eio.STDOUT, file = writeend }, { istype = "writefunc", dup = eio.STDERR, linebuffer = true, callfn = log_git }, } - pid, re = e2lib.callcmd(git_argv, fdctv, nil, nil, true) + pid, re = e2lib.callcmd(git_argv, git_fdctv, nil, nil, 'nopoll') if not pid then return false, e:cat(re) end table.insert(children, { pid=pid, name="git" }) - fdctv = { + tar_fdctv = { { istype = "readfo", dup = eio.STDIN, file = readend }, { istype = "readfo", dup = eio.STDOUT, file = devnull } } - pid, re = e2lib.callcmd(tar_argv, fdctv, nil, nil, true) + pid, re = e2lib.callcmd(tar_argv, tar_fdctv, nil, nil, 'nopoll') if not pid then return false, e:cat(re) end table.insert(children, { pid=pid, name="tar" }) + rc, re = e2lib.callcmd_poll(git_fdctv, tar_fdctv) + if not rc then + return false, e:cat(re) + end + + rc, re = e2lib.callcmd_cleanup(git_fdctv) + if not rc then + return false, e:cat(re) + end + + rc, re = e2lib.callcmd_cleanup(tar_fdctv) + if not rc then + return false, e:cat(re) + end + local errors = false while (#children > 0) do local found = false -- 2.39.5