Enforce bash in exec stdin test instead of trying to use powershell

This commit is contained in:
Filip Tibell 2025-04-25 13:53:41 +02:00
parent 5a23cf04fa
commit 7cbeafc5b3
No known key found for this signature in database

View file

@ -2,9 +2,10 @@ local process = require("@lune/process")
local expected = "Hello from child process!" local expected = "Hello from child process!"
local result = if process.os == "windows" -- NOTE: This requires "bash" to be installed even for Windows
then process.exec("powershell", { "-Command", "$input" }, { stdio = { stdin = expected } }) -- users, testing a simple cat from stdin to stdout using pwsh
else process.exec("xargs", { "echo" }, { stdio = { stdin = expected } }) -- has unfortunately proved to be a significant challenge...
local result = process.exec("bash", { "-c", "cat" }, { stdio = { stdin = expected } })
local resultStdout = result.stdout local resultStdout = result.stdout
resultStdout = string.gsub(resultStdout, "^%s+", "") -- Trim leading whitespace resultStdout = string.gsub(resultStdout, "^%s+", "") -- Trim leading whitespace