summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-09-01 17:13:29 +0800
committerruki <[email protected]>2016-09-01 17:13:29 +0800
commit3a069cb96018c3074044c26f9a42b9457467a926 (patch)
tree8eeaece47a0f92e660176b9dcd0bf161aee78bbc
parent3e514c11027249b2c60966af5f2d5f5ae8eb361b (diff)
fix run task path bug
-rw-r--r--xmake/core/project/task.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/xmake/core/project/task.lua b/xmake/core/project/task.lua
index aa43ec907..1c513439e 100644
--- a/xmake/core/project/task.lua
+++ b/xmake/core/project/task.lua
@@ -396,8 +396,17 @@ function task.run(name, ...)
return false, string.format("task(\"%s\"): no run script, please call on_task_run() first!", name)
end
+ -- save the current directory
+ local curdir = os.curdir()
+
-- run task
- return sandbox.load(taskinfo.run, ...)
+ local ok, errors = sandbox.load(taskinfo.run, ...)
+
+ -- restore the current directory
+ os.cd(curdir)
+
+ -- ok?
+ return ok, errors
end
-- the menu