Skip to content

eduardomv2/Proyecto-Reproductor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published