Instances 3.0.1

Instances

A .NET Standard Process wrapper with an elegant API, for both asyncronous and syncronous use, providing both Events and support for Tasks with cancellation support

.NET Core codecov.io GitHub Nuget Nuget Dependent repos (via libraries.io)

Usage

There are three ways to use this library, requiring at least 1, 2, or 3 lines of code to use.

Shortest form, supporting only few options

var result = await Instance.FinishAsync("dotnet", "build -c Release", cancellationToken);
Console.WriteLine(result.ExitCode);
// or
var result = Instance.Finish("dotnet", "build -c Release");

Short form, supporting more options

using var instance = Instance.Start("dotnet", "build -c Release");
var result = await instance.WaitForExitAsync(cancellationToken);
// or
using var instance = Instance.Start("dotnet", "build -c Release");
var result = instance.WaitForExit();

Full form, supporting all options

var processArgument = new ProcessArguments("dotnet", "build -c Release");
processArgument.Exited += (_, exitResult) => Console.WriteLine(exitResult.ExitCode);
processArgument.OutputDataReceived += (_, data) => Console.WriteLine(data);
processArgument.ErrorDataReceived += (_, data) => Console.WriteLine(data);

using var instance = processArgument.Start();

var result = await instance.WaitForExitAsync(cancellationToken);
// or 
var result = instance.WaitForExit();

Features

using var instance = Instance.Start("dotnet", "build -c Release");

// send input to process' standard input
instance.SendInput("Hello World");

// stop the process
instance.Kill();

// access process output
foreach (var line in instance.OutputData)
    Console.WriteLine(line);
// and error data easily while the process is running
foreach (var line in instance.ErrorData)
    Console.WriteLine(line);

// or wait for the process to exit (with support for cancellation token)
var result = await instance.WaitForExitAsync(cancellationToken);
Console.WriteLine(result.ExitCode);
Console.WriteLine(result.OutputData.Count);

Showing the top 20 packages that depend on Instances.

Packages Downloads
FFMpegCore
A .NET Standard FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your .NET applications
16
FFMpegCore
A .NET Standard FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your .NET applications
4
FFMpegCore
A great way to use FFMpeg encoding when writing video applications, client-side and server-side. It has wrapper methods that allow conversion to all web formats: MP4, OGV, TS and methods of capturing screens from the videos.
4
FFMpegCore
A .NET Standard FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your .NET applications
3
FFMpegCore
A great way to use FFMpeg encoding when writing video applications, client-side and server-side. It has wrapper methods that allow conversion to all web formats: MP4, OGV, TS and methods of capturing screens from the videos.
3
FFMpegCore
A .NET Standard FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your C# applications
3

- Bump dependencies - Fix for cancellation cornercase in WaitForExitAsync

.NET Standard 2.0

  • No dependencies.

Version Downloads Last updated
3.0.1 1 12/22/2024
3.0.0 3 10/06/2024
2.0.0 3 04/21/2022
1.6.1 2 10/06/2024
1.6.0 18 07/25/2022
1.5.0 3 10/06/2024
1.4.0 2 10/06/2024
1.3.3 2 10/06/2024
1.3.2 2 10/06/2024
1.3.1 2 10/06/2024
1.3.0 3 10/06/2024
1.2.0 2 10/06/2024
1.1.0 2 10/06/2024
1.0.0 2 10/06/2024