summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-14 23:12:36 +0800
committerruki <[email protected]>2022-04-14 23:12:36 +0800
commit23dd00c8f43b6c84a617578ae960e5d79f1735f5 (patch)
tree69e5bc6f42a27ad20d027ddf0e50cbae19fe355e
parent5bcfeceab31c4b922cc44fb47d02f9cbc3ee161e (diff)
add stdin pipe
-rw-r--r--xmake/modules/private/service/remote_build/session.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/xmake/modules/private/service/remote_build/session.lua b/xmake/modules/private/service/remote_build/session.lua
index 561acbb82..c88ec5829 100644
--- a/xmake/modules/private/service/remote_build/session.lua
+++ b/xmake/modules/private/service/remote_build/session.lua
@@ -91,12 +91,17 @@ function session:runcmd(respmsg)
local program = body.program
local argv = body.argv
vprint("%s: run command(%s) ..", self, os.args(table.join(program, argv)))
- local rpipe, wpipe = pipe.openpair(10)
- local rpipeopt = {rpipe = rpipe, stop = false}
- scheduler.co_start(self._read_pipe, self, rpipeopt)
- os.execv(program, argv, {curdir = self:sourcedir(), stdout = wpipe})
- rpipeopt.stop = true
- wpipe:close()
+ local stdin_rpipe, stdin_wpipe = pipe.openpair(256)
+ local stdin_wpipeopt = {wpipe = stdin_wpipe, stop = false}
+ local stdout_rpipe, stdout_wpipe = pipe.openpair(256)
+ local stdout_rpipeopt = {rpipe = stdout_rpipe, stop = false}
+ scheduler.co_start(self._write_pipe, self, stdin_wpipeopt)
+ scheduler.co_start(self._read_pipe, self, stdout_rpipeopt)
+ os.execv(program, argv, {curdir = self:sourcedir(), stdout = stdout_wpipe, stdin = stdin_rpipe})
+ stdin_wpipeopt.stop = true
+ stdin_wpipe:close()
+ stdout_rpipeopt.stop = true
+ stdout_wpipe:close()
vprint("%s: run command ok", self)
end
@@ -135,6 +140,10 @@ function session:_reset_sourcedir()
end
end
+-- write data from pipe
+function session:_write_pipe(opt)
+end
+
-- read data from pipe
function session:_read_pipe(opt)
local buff = bytes(256)