I am using Microsoft.PowerShell.SDK (Version 7.3.3) in order to clone a git repository from C# like this:
(Note: I know there is libgit2sharp, but it doesn't support all of my use cases).
using (var ps = PowerShell.Create())
{
ps.AddScript($"git clone {url} {localPath}");
ps.Invoke();
if (ps.HadErrors)
{
Console.WriteLine("Errors occurred: ");
foreach (var error in ps.Streams.Error)
{
Console.WriteLine(error.ToString());
}
}
}
When successfully pulling a repository with that, I get the following output on the console:
Errors occurred:
Cloning into '<local path>' ...
Why does the informational output end up in the error stream?