From 5511722baa97e852b83227c2fde12039108fbbc1 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 4 Nov 2025 22:30:32 +0800 Subject: fix bin2c thread --- xmake/modules/utils/run_script.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'xmake/modules/utils/run_script.lua') diff --git a/xmake/modules/utils/run_script.lua b/xmake/modules/utils/run_script.lua index a5ab2fa50..82fa8cb0d 100644 --- a/xmake/modules/utils/run_script.lua +++ b/xmake/modules/utils/run_script.lua @@ -150,14 +150,19 @@ function _run(script, opt) option.set("quiet", true, {force = true}) end - local curdir = opt.curdir or os.workingdir() - local oldir = os.cd(curdir) + local oldir + if xmake.in_main_thread() then + local curdir = opt.curdir or os.workingdir() + oldir = os.cd(curdir) + end if opt.command then _run_commanad(script, _get_args(opt), opt) else _run_script(script, _get_args(opt), opt) end - os.cd(oldir) + if oldir then + os.cd(oldir) + end if opt.quiet then option.restore() -- cgit v1.3.1