summaryrefslogtreecommitdiff
path: root/xmake/plugins/lua/main.lua
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-02-02 09:00:50 +0300
committerSaikari <[email protected]>2026-02-02 09:00:50 +0300
commit33409f7b71773265fba3a6f688cdf97262770511 (patch)
treef7e1655a84bdfe161dafb57294493f0d8c15fe4b /xmake/plugins/lua/main.lua
parentc6aa73fa21bba45a591aa185b4d4a3648417b35f (diff)
refactor: streamline stdin script handling for Windows compatibility
Diffstat (limited to 'xmake/plugins/lua/main.lua')
-rw-r--r--xmake/plugins/lua/main.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/xmake/plugins/lua/main.lua b/xmake/plugins/lua/main.lua
index 247684e24..7137ea589 100644
--- a/xmake/plugins/lua/main.lua
+++ b/xmake/plugins/lua/main.lua
@@ -67,12 +67,11 @@ function main()
if script_content:startswith("\239\187\191") then
script_content = script_content:sub(4)
end
- import("core.base.tty")
- local shell = tty.shell()
- if shell == "cmd" or shell == "powershell" or shell == "pwsh" or os.host() == "windows" then
+ local shell = os.shell()
+ if shell == "cmd" or shell == "powershell" or shell == "pwsh" or is_host("windows") then
script_content = script_content:trim()
if script_content:startswith('"') and script_content:endswith('"') then
- script_content = script_content:sub(2, -2)
+ script_content = script_content:trim('\"')
end
script_content = script_content:replace("\\n", "\n", {plain = true}):replace("\\r", "\r", {plain = true})
end