diff options
| author | ruki <[email protected]> | 2022-06-29 00:53:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-06-29 00:53:40 +0800 |
| commit | 7e2f4dc36f81a3bbd0c188591886e697c2320f5b (patch) | |
| tree | 25945ddcad7654f536878e47c3d5a7e9733d48c7 /xmake/modules/private/service/remote_build/client.lua | |
| parent | 3f131675ed167ae3eed2afc0bfb69b633a8080a6 (diff) | |
fix remote build
Diffstat (limited to 'xmake/modules/private/service/remote_build/client.lua')
| -rw-r--r-- | xmake/modules/private/service/remote_build/client.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xmake/modules/private/service/remote_build/client.lua b/xmake/modules/private/service/remote_build/client.lua index f76699790..fe964f054 100644 --- a/xmake/modules/private/service/remote_build/client.lua +++ b/xmake/modules/private/service/remote_build/client.lua @@ -274,7 +274,10 @@ function remote_build_client:runcmd(program, argv) local stream = socket_stream(sock) if stream:send_msg(message.new_runcmd(session_id, program, argv, {token = self:token()})) and stream:flush() then local stdin_opt = {stop = false} - scheduler.co_start(self._read_stdin, self, stream, stdin_opt) + local group_name = "remote_build/runcmd" + scheduler.co_group_begin(group_name, function (co_group) + scheduler.co_start(self._read_stdin, self, stream, stdin_opt) + end) while true do local msg = stream:recv_msg() if msg then @@ -291,6 +294,9 @@ function remote_build_client:runcmd(program, argv) errors = string.format("recv output data(%d) failed!", msg:body().size) break end + elseif msg:is_end() then + ok = true + break else if msg:success() then ok = true @@ -304,6 +310,7 @@ function remote_build_client:runcmd(program, argv) end end stdin_opt.stop = true + scheduler.co_group_wait(group_name) end if #leftstr > 0 then cprint(leftstr) @@ -503,9 +510,12 @@ function remote_build_client:_read_stdin(stream, opt) os.sleep(500) end end + -- say bye + if stream:send_msg(message.new_end({token = self:token()})) then + stream:flush() + end end - function remote_build_client:__tostring() return "<remote_build_client>" end |
