summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-18 22:43:43 +0800
committerruki <[email protected]>2025-08-28 11:35:53 +0800
commit5c371c00ead44993b83f26a754c32a3f8a799aa4 (patch)
treee8fbd713e52cce76f427a873ace680b983907928
parentad77d170e407fc7d346df32a88683aae050bf36b (diff)
fix return errors
-rw-r--r--xmake/core/main.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/xmake/core/main.lua b/xmake/core/main.lua
index 95202b04c..632165717 100644
--- a/xmake/core/main.lua
+++ b/xmake/core/main.lua
@@ -262,7 +262,7 @@ end
function main._run_task(taskname)
local taskinst = task.task(taskname) or project.task(taskname)
if not taskinst then
- return main._exit(false, string.format("do unknown task(%s)!", taskname))
+ return false, string.format("do unknown task(%s)!", taskname)
end
scheduler:co_start_named("xmake " .. taskname, function ()
@@ -271,18 +271,20 @@ function main._run_task(taskname)
os.raise(errors)
end
end)
+ return true
end
-- run thread
function main._run_thread(callinfo_str)
local callinfo, errors = string.deserialize(callinfo_str)
if not callinfo then
- return main._exit(false, string.format("invalid thread callinfo, %s!", errors or "unknown"))
+ return false, string.format("invalid thread callinfo, %s!", errors or "unknown")
end
local callback = callinfo.callback
if callback then
callback(callinfo.argv)
end
+ return true
end
-- the main entry function
@@ -347,9 +349,12 @@ Or you can add `--root` option or XMAKE_ROOT=y to allow run as root temporarily.
-- run task or thread
local thread_callinfo = xmake._THREAD_CALLINFO
if thread_callinfo then
- main._run_thread(thread_callinfo)
+ ok, errors = main._run_thread(thread_callinfo)
else
- main._run_task(option.taskname() or "build")
+ ok, errors = main._run_task(option.taskname() or "build")
+ end
+ if not ok then
+ return main._exit(ok, errors)
end
-- start runloop