diff options
| author | Saikari <[email protected]> | 2026-02-01 18:15:24 +0300 |
|---|---|---|
| committer | Saikari <[email protected]> | 2026-02-01 18:15:24 +0300 |
| commit | 1056c09cb31f7e873573d4e0a5a24d06af8297df (patch) | |
| tree | bdf977bff3a3f5158e39afca6289b85cef6ed130 /tests/modules/stdin/test.lua | |
| parent | 74a37990201fa351fc433ff3cc2d698eeb9846c4 (diff) | |
refactor: enhance APE/Cosmocc workaround by creating a temporary xmake alias for compatibility
Diffstat (limited to 'tests/modules/stdin/test.lua')
| -rw-r--r-- | tests/modules/stdin/test.lua | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/modules/stdin/test.lua b/tests/modules/stdin/test.lua index d942b7858..162b58d53 100644 --- a/tests/modules/stdin/test.lua +++ b/tests/modules/stdin/test.lua @@ -4,6 +4,20 @@ function main(t) xmake = xmake:gsub("/", "\\") end + -- APE/Cosmocc workaround: force xmake name to avoid APE loader mode issues (e.g. ape-x86_64.elf) + local function setup_xmake_alias(xmake) + if path.filename(xmake):find("ape-", 1, true) then + local xmake_dir = path.join(os.tmpdir(), "xmake_ape_" .. os.time()) + os.mkdir(xmake_dir) + local xmake_alias = path.join(xmake_dir, os.host() == "windows" and "xmake.exe" or "xmake") + os.trycp(xmake, xmake_alias) + return xmake_alias + end + return xmake + end + + xmake = setup_xmake_alias(xmake) + local function test_shell(name, cmd, expect) print("testing " .. name .. ": " .. cmd) local outfile = os.tmpfile() @@ -114,20 +128,12 @@ function main(t) ) test_shell( "pwsh_main", - string.format( - '%s -c "echo \\"function main() print(\'in_pwsh_main\') end\\" | %s"', - pwsh, - run_stdin - ), + string.format('%s -c "echo \\"function main() print(\'in_pwsh_main\') end\\" | %s"', pwsh, run_stdin), "in_pwsh_main" ) test_shell( "pwsh_multi", - string.format( - '%s -c "echo \\"print(\'pline1\')\\" \\"print(\'pline2\')\\" | %s"', - pwsh, - run_stdin - ), + string.format('%s -c "echo \\"print(\'pline1\')\\" \\"print(\'pline2\')\\" | %s"', pwsh, run_stdin), "pline1[\r\n]+pline2" ) end |
