diff options
| author | ruki <[email protected]> | 2025-09-13 22:53:09 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-09-13 22:53:34 +0800 |
| commit | 8069f629429c9db558b5bff6274358535be3043b (patch) | |
| tree | 78e3ab84d0d44900cb87abe3b6b7677adfca6875 | |
| parent | 8241b150316595df554dfeab99efca618eef7412 (diff) | |
fix run script
| -rw-r--r-- | xmake/core/base/tty.lua | 43 | ||||
| -rw-r--r-- | xmake/modules/utils/run_script.lua | 4 |
2 files changed, 27 insertions, 20 deletions
diff --git a/xmake/core/base/tty.lua b/xmake/core/base/tty.lua index 56d6f9942..1e44c64bf 100644 --- a/xmake/core/base/tty.lua +++ b/xmake/core/base/tty.lua @@ -153,28 +153,34 @@ end function tty.shell() local shell = tty._SHELL if shell == nil then - local subhost = xmake._SUBHOST - if subhost == "windows" then - if os.getenv("PROMPT") then - shell = "cmd" - else - local ok, result = os.iorun("pwsh -v") - if ok then - shell = "pwsh" + if os.getenv("NU_VERSION") then + shell = "nu" + end + if not shell then + local subhost = xmake._SUBHOST + if subhost == "windows" then + if os.getenv("PROMPT") then + shell = "cmd" else - shell = "powershell" + local ok, result = os.iorun("pwsh -v") + if ok then + shell = "pwsh" + else + shell = "powershell" + end end end - else + end + if not shell then shell = os.getenv("XMAKE_SHELL") - if not shell then - shell = os.getenv("SHELL") - if shell then - for _, shellname in ipairs({"zsh", "bash", "sh"}) do - if shell:find(shellname) then - shell = shellname - break - end + end + if not shell then + shell = os.getenv("SHELL") + if shell then + for _, shellname in ipairs({"zsh", "bash", "sh"}) do + if shell:find(shellname) then + shell = shellname + break end end end @@ -445,3 +451,4 @@ end -- return module return tty + diff --git a/xmake/modules/utils/run_script.lua b/xmake/modules/utils/run_script.lua index de625119f..a5ab2fa50 100644 --- a/xmake/modules/utils/run_script.lua +++ b/xmake/modules/utils/run_script.lua @@ -66,11 +66,11 @@ function _run_script(script, args, opt) -- run the given lua script file (xmake lua /tmp/script.lua) script_type, script_name = "given lua script file", path.relative(script) func = import(path.basename(script), {rootdir = path.directory(script), anonymous = true}) - elseif os.isfile(path.join(os.scriptdir(), "scripts", script .. ".lua")) then + elseif os.isfile(path.join(os.programdir(), "plugins", "lua", "scripts", script .. ".lua")) then -- run builtin lua script (xmake lua echo "hello xmake") script_type, script_name = "builtin lua script", script - func = import("scripts." .. script, {anonymous = true}) + func = import("scripts." .. script, {anonymous = true, rootdir = path.join(os.programdir(), "plugins", "lua")}) else -- attempt to find the builtin module |
