diff options
| author | ruki <[email protected]> | 2025-11-06 00:43:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-07 15:01:57 +0800 |
| commit | 4eb4c7c0c524823684eab4d7015a3383ed8ab511 (patch) | |
| tree | f0fd85c7f4435afd40417dc56c13bb498dd99e37 | |
| parent | 77216b72f1fe667e5b332446dbf004a71e267de3 (diff) | |
fix argv in thread
| -rw-r--r-- | xmake/core/_xmake_main.lua | 6 | ||||
| -rw-r--r-- | xmake/core/base/option.lua | 2 | ||||
| -rw-r--r-- | xmake/core/base/private/async_task.lua | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/xmake/core/_xmake_main.lua b/xmake/core/_xmake_main.lua index 00538c864..139e6d20c 100644 --- a/xmake/core/_xmake_main.lua +++ b/xmake/core/_xmake_main.lua @@ -40,6 +40,12 @@ xmake._EMBED = _EMBED xmake._THREAD_CALLBACK = _THREAD_CALLBACK xmake._THREAD_CALLINFO = _THREAD_CALLINFO +-- we need not any arguments in sub-thread. +-- because it always uses CommandLineToArgvW() on windows, so we need to reset it. +if _THREAD_CALLBACK then + xmake._ARGV = {} +end + -- In order to be compatible with updates from lower versions of engine core -- @see https://github.com/xmake-io/xmake/issues/1694#issuecomment-925507210 if xmake._LUAJIT == nil then diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua index 9c750c30b..6d46bddef 100644 --- a/xmake/core/base/option.lua +++ b/xmake/core/base/option.lua @@ -119,7 +119,7 @@ function option.init(menu) end -- not found? - if xmake.in_main_thread() and (not context.taskname or not menu[context.taskname]) then + if not context.taskname or not menu[context.taskname] then option.show_main() return false, "invalid task: " .. xmake._COMMAND end diff --git a/xmake/core/base/private/async_task.lua b/xmake/core/base/private/async_task.lua index 7c5baf0df..7b8219e24 100644 --- a/xmake/core/base/private/async_task.lua +++ b/xmake/core/base/private/async_task.lua @@ -152,7 +152,6 @@ function async_task._loop(event, queue, mutex, is_stopped, is_diagnosis) if event:wait(-1) > 0 then -- fetch all tasks from queue at once - dprint("async_task: fetching tasks ..") local cmds = {} mutex:lock() while not queue:empty() do @@ -168,7 +167,6 @@ function async_task._loop(event, queue, mutex, is_stopped, is_diagnosis) for _, cmd in ipairs(cmds) do _runcmd(cmd) end - dprint("async_task: handle tasks(%d) done", #cmds) end end dprint("async_task: exited") @@ -203,7 +201,6 @@ function async_task._start() end task_is_stopped:set(true) task_event:post() - utils.dprint("async_task: wait exiting thread ..") task_thread:wait(-1) utils.dprint("async_task: wait finished") end |
