mirror of
https://github.com/lune-org/lune.git
synced 2025-05-04 10:43:57 +01:00
Enforce bash in exec stdin test instead of trying to use powershell
This commit is contained in:
parent
5a23cf04fa
commit
7cbeafc5b3
1 changed files with 4 additions and 3 deletions
|
@ -2,9 +2,10 @@ local process = require("@lune/process")
|
|||
|
||||
local expected = "Hello from child process!"
|
||||
|
||||
local result = if process.os == "windows"
|
||||
then process.exec("powershell", { "-Command", "$input" }, { stdio = { stdin = expected } })
|
||||
else process.exec("xargs", { "echo" }, { stdio = { stdin = expected } })
|
||||
-- NOTE: This requires "bash" to be installed even for Windows
|
||||
-- users, testing a simple cat from stdin to stdout using pwsh
|
||||
-- has unfortunately proved to be a significant challenge...
|
||||
local result = process.exec("bash", { "-c", "cat" }, { stdio = { stdin = expected } })
|
||||
|
||||
local resultStdout = result.stdout
|
||||
resultStdout = string.gsub(resultStdout, "^%s+", "") -- Trim leading whitespace
|
||||
|
|
Loading…
Add table
Reference in a new issue