Skip to content

jsakamoto/XProcess

Repository files navigation

XProcess NuGet Package unit tests

This is a library for .NET that allows you to invoke an external process, and expose its output as an async stream in C# 8.0.

Usage

using Toolbelt.Diagnostics;
...
using var process = await XProcess.Start("foo.exe").WaitForExitAsync();
if (process.ExitCode != 0) throw new Exception(process.Output);
using Toolbelt.Diagnostics;
...
using var process = XProcess.Start("foo.exe");
await foreach(string output in process.GetOutputAsyncStream())
{
  // do something.
}
// When reaching here, it means the process was exited.
using Toolbelt.Diagnostics;
...
using var process = XProcess.Start("foo.exe");
var found = await process.WaitForOutputAsync(str => str.Contains("Now listening on:"), millsecondsTimeout: 5000);
// If the "found" is false, it means the process had not outputed "Now listening on:" in 5 sec.

Release Notes

Release notes is here.

License

Mozilla Public License ver.2.0

About

This is a library for .NET that allows you to invoke an external process, and expose its output as an async stream in C# 8.0.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages