diff options
| author | Saikari <[email protected]> | 2026-02-02 13:42:32 +0300 |
|---|---|---|
| committer | Saikari <[email protected]> | 2026-02-02 13:42:32 +0300 |
| commit | a7d56edc0dfdcfce0d4c0eb56465c63c86bf5f98 (patch) | |
| tree | d991cf8330c321bd5202d89d99be567c4454ac69 | |
| parent | 71b0520a355f1a5e4ba0be5f2ef042118aed8432 (diff) | |
refactor: streamline xmake path resolution and improve ape programfile handling
| -rw-r--r-- | tests/modules/stdin/test.lua | 9 |
1 files 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 |
