From a7d56edc0dfdcfce0d4c0eb56465c63c86bf5f98 Mon Sep 17 00:00:00 2001 From: Saikari Date: Mon, 2 Feb 2026 13:42:32 +0300 Subject: refactor: streamline xmake path resolution and improve ape programfile handling --- tests/modules/stdin/test.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/modules/stdin/test.lua b/tests/modules/stdin/test.lua index f1aee7f27..4d24d1dd6 100644 --- a/tests/modules/stdin/test.lua +++ b/tests/modules/stdin/test.lua @@ -1,3 +1,5 @@ +import("core.base.binutils") + function resolve_path(p) if path.is_absolute(p) then return p end local root = path.join(os.scriptdir(), "../../..") @@ -7,7 +9,6 @@ function resolve_path(p) return p end --- Fix /usr/bin/ape loader mode on Linux function fix_ape_programfile(xmake) if is_host("linux") and path.filename(xmake):find("ape", 1, true) and os.isfile("/proc/self/cmdline") then local content = io.readfile("/proc/self/cmdline", {encoding = "binary"}) @@ -27,15 +28,11 @@ end function main(t) local xmake = path.unix(os.programfile()) - if is_host("windows") then - xmake = xmake:gsub("/", "\\") - end - xmake = resolve_path(xmake) -- Fix pwsh and cosmocc "err: ape error: l: not found (maybe chmod +x or ./ needed)" for Linux xmake = fix_ape_programfile(xmake) - local is_ape = path.filename(xmake):find("ape", 1, true) ~= nil or xmake:endswith(".com") + local is_ape = binutils.format(os.programfile()) == "ape" local run_stdin = string.format('"%s" l --stdin', xmake) if not is_host("windows") then -- cgit v1.3.1