summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-15 00:45:16 +0800
committerruki <[email protected]>2022-04-15 00:45:16 +0800
commit55f541667ccd31e67e61d7eeeeff412552336903 (patch)
tree63397ffb88713b8ee28522305c9cc8386b86246e /xmake/modules
parenta61b2aa25af04eb75c6628fbb4f867c9a82ae72a (diff)
improve pipe mode
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/private/service/remote_build/session.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/xmake/modules/private/service/remote_build/session.lua b/xmake/modules/private/service/remote_build/session.lua
index 04f053e68..b78ddf8c4 100644
--- a/xmake/modules/private/service/remote_build/session.lua
+++ b/xmake/modules/private/service/remote_build/session.lua
@@ -91,13 +91,21 @@ 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 stdin_rpipe, stdin_wpipe = pipe.openpair(256)
+
+ -- init pipes
+ local stdin_rpipe, stdin_wpipe = pipe.openpair("BA") -- rpipe (block)
local stdin_wpipeopt = {wpipe = stdin_wpipe, stop = false}
- local stdout_rpipe, stdout_wpipe = pipe.openpair(256)
+ local stdout_rpipe, stdout_wpipe = pipe.openpair()
local stdout_rpipeopt = {rpipe = stdout_rpipe, stop = false}
+
+ -- read and write pipe
scheduler.co_start(self._write_pipe, self, stdin_wpipeopt)
scheduler.co_start(self._read_pipe, self, stdout_rpipeopt)
+
+ -- run program
os.execv(program, argv, {curdir = self:sourcedir(), stdout = stdout_wpipe, stdin = stdin_rpipe})
+
+ -- stop it
stdin_wpipeopt.stop = true
stdin_wpipe:close()
stdout_rpipeopt.stop = true