Ein Blog

.NET 11 Preview 4 ist erschienen. Neu sind ein paar APIs in der Process-Klasse:

using System.Diagnostics;

// One-shot capture: stdout and stderr together, plus exit code.
ProcessTextOutput result = await Process.RunAndCaptureTextAsync(
    "git", ["status", "--porcelain"]);

Console.WriteLine(result.StandardOutput);
Console.WriteLine($"exit code: {result.ExitStatus.ExitCode}");

Andere Methoden: Process.Run, Process.RunAsync, Process.RunAndCaptureText, and Process.RunAndCaptureTextAsync.

Sehr handlich, das war immer unnötig kompliziert, das jedes Mal selbst zu bauen.