summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-14 00:46:05 +0800
committerruki <[email protected]>2022-04-14 00:46:05 +0800
commitced667a2f0a0b9ebf92456214b4bbb6d70ed74ed (patch)
tree389b8cd5ccab1795349464969d3a6e01ad557d54
parente1f100f3b1da3cdd8592e1c7567f61f4f039a0f7 (diff)
runcmd in server
-rw-r--r--xmake/modules/private/service/message.lua2
-rw-r--r--xmake/modules/private/service/remote_build/client.lua2
-rw-r--r--xmake/modules/private/service/remote_build/session.lua7
3 files changed, 5 insertions, 6 deletions
diff --git a/xmake/modules/private/service/message.lua b/xmake/modules/private/service/message.lua
index e8c387681..84c3f464f 100644
--- a/xmake/modules/private/service/message.lua
+++ b/xmake/modules/private/service/message.lua
@@ -135,7 +135,7 @@ end
function new_sync(session_id, start)
return _new({
code = message.CODE_SYNC,
- start = start or true,
+ start = start,
session_id = session_id
})
end
diff --git a/xmake/modules/private/service/remote_build/client.lua b/xmake/modules/private/service/remote_build/client.lua
index 87db928c2..72553b9f5 100644
--- a/xmake/modules/private/service/remote_build/client.lua
+++ b/xmake/modules/private/service/remote_build/client.lua
@@ -157,7 +157,7 @@ function remote_build_client:sync()
print("%s: sync files in %s:%d ..", self, addr, port)
if sock then
local stream = socket_stream(sock)
- if stream:send_msg(message.new_sync(session_id)) and stream:flush() then
+ if stream:send_msg(message.new_sync(session_id, true)) and stream:flush() then
local msg = stream:recv_msg()
if msg and msg:success() then
vprint(msg:body())
diff --git a/xmake/modules/private/service/remote_build/session.lua b/xmake/modules/private/service/remote_build/session.lua
index 7826b0bc6..16d131151 100644
--- a/xmake/modules/private/service/remote_build/session.lua
+++ b/xmake/modules/private/service/remote_build/session.lua
@@ -58,10 +58,7 @@ function session:sync(respmsg)
body.path = sourcedir
body.branch = source_branch
else
- local branch = git.branch({repodir = sourcedir})
- if not branch or branch ~= source_branch then
- git.checkout(source_branch, {repodir = sourcedir})
- end
+ git.checkout(source_branch, {repodir = sourcedir})
end
vprint("%s: %s sync files ok", self, body.start and "start" or "finish")
end
@@ -79,6 +76,8 @@ function session:runcmd(respmsg)
local program = body.program
local argv = body.argv
vprint("%s: run command(%s) ..", self, os.args(table.join(program, argv)))
+ print(self:sourcedir())
+ os.execv(program, argv, {curdir = self:sourcedir()})
vprint("%s: run command ok", self)
end