From: Tobias Ulmer Date: Mon, 2 Jan 2017 19:21:48 +0000 (+0100) Subject: e2lib: extend callcmd() X-Git-Tag: e2factory-2.3.16rc1~8 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=272d237836f9d3a47ba32f4ed8134e48cf75e818;p=e2factory.git e2lib: extend callcmd() Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 80ac0c1..3db930c 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -1110,7 +1110,7 @@ end -- "readfo", the following field are expected in addition to ones in fdct. -- The file object is used as an input to the child. -- @table fdct_readfo --- @field file Readable file object. +-- @field file Readable file object or file descriptor (number). -- @see fdct --- File descriptor configuration table - writefunc. This is an extension to @@ -1200,7 +1200,13 @@ function e2lib.callcmd(argv, fdctv, workdir, envdict, nowait) end end elseif fdct.istype == "readfo" then - rc, re = eio.dup2(eio.fileno(fdct.file), fdct.dup) + local fd + if type(fdct.file) == "number" then + fd = fdct.file + else + fd = eio.fileno(fdct.file) + end + rc, re = eio.dup2(fd, fdct.dup) if not rc then e2lib.abort(re) end