Closed
Description
Description
On Linux, I have tried to use the Process to spawn a new process to interact/manipulate with its output. However, I realized that if the process spawns a child process, on the same shell, you won't be able to retrieve the output of the child process. Is that the expected behaviour? Is there a way to do that?
Example:
var process = new Process
{
StartInfo = new ProcessStartInfo("git", "fetch --all")
{
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardInput = true,
RedirectStandardOutput = true
}
};
process.Start();
process.OutputDataReceived += HandleUsernameRequest(process.StandardInput);
process.OutputDataReceived += HandlePasswordRequest(process.StandardInput);
process.BeginOutputReadLine();
The process will capture the first line output "Fetching origin", but not the line that requires to enter the username.
So, this was the output (the second line is not being captured):
Output: Fetching origin
Username for 'https://www.ve-smartapps.bt.com':
However, I was expecting:
Output: Fetching origin
Output: Username for 'https://www.ve-smartapps.bt.com':
Configuration
- Which version of .NET is the code running on? 5.0.100-preview.8.20417.9
- What OS and version, and what distro if applicable? Ubuntu 20.04
- What is the architecture (x64, x86, ARM, ARM64)? x64
- Do you know whether it is specific to that configuration? No.
Regression?
The same happens on .NET Core 3.1.