Closed my522cn closed 2 years ago
Can you check if the same thing works using Process
?
using var process = new Process
{
StartInfo =
{
FileName = path,
RedirectStandardOutput = true
}
};
process.Start();
var output = process.StandardOutput.ReadToEnd();
Can you check if the same thing works using
Process
?using var process = new Process { StartInfo = { FileName = path, RedirectStandardOutput = true } }; process.Start(); var output = process.StandardOutput.ReadToEnd();
it works using Process: but without \n
I'd appreciate it if you can figure out where the bug is in CliWrap. I'm currently preoccupied with a war looming on the horizon. 🙁
It's incredibly challenging for me. I will PR if I figure the bug out.
I did this in command line:
/bin/bash -c "echo test1; read -r -p test2; echo test3" > foo.txt
The output file contained only:
test1
test3
So it might be that's just how read
works when stdout is redirected?
Tested using System.Diagnostics.Process
with the below code, the result is the same.
using var process = new Process
{
StartInfo =
{
FileName = "/bin/bash",
Arguments = "-c \"echo test1; read -r -p test2; echo test3\"",
RedirectStandardOutput = true
}
};
process.Start();
var output = process.StandardOutput.ReadToEnd();
Closing as it doesn't seem to be a problem with CliWrap.
Version
3.4.1
Details
The 'read' shell script can not be redirect to StandardOutput.
Here's the C# code:
Here's the shell code
"Ready for test press any key or wait for 3 s" was not printed
Steps to reproduce
As details above.