From 28b9b472ca6abb227ca6ac0b7ff7d48a2fedac7a Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 29 May 2022 16:44:12 +0800 Subject: improve rundir for xmake run --- xmake/actions/run/main.lua | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua index 50711ffbc..68a2e3863 100644 --- a/xmake/actions/run/main.lua +++ b/xmake/actions/run/main.lua @@ -44,9 +44,6 @@ function _do_run_target(target) -- get the absolute target file path local targetfile = path.absolute(target:targetfile()) - -- enter the run directory - local oldir = os.cd(rundir) - -- add run environments local addrunenvs, setrunenvs = make_runenvs(target) for name, values in pairs(addrunenvs) do @@ -58,13 +55,10 @@ function _do_run_target(target) -- debugging? if option.get("debug") then - debugger.run(targetfile, option.get("arguments")) + debugger.run(targetfile, option.get("arguments"), {curdir = rundir}) else - os.execv(targetfile, option.get("arguments"), {detach = option.get("detach")}) + os.execv(targetfile, option.get("arguments"), {curdir = rundir, detach = option.get("detach")}) end - - -- restore the previous directory - os.cd(oldir) end -- run target -- cgit v1.3.1