RunProcess 1.0.5

A process host for Windows (Vista and later) that is more reliable and flexible than System.Diagnostics.Process

There is a newer version of this package available.
See the version list below for details.
Install-Package RunProcess -Version 1.0.5
dotnet add package RunProcess --version 1.0.5
<PackageReference Include="RunProcess" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RunProcess --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

RunProcess

A process host for Windows (Vista and later) that is more reliable and flexible than System.Diagnostics.Process

Allows run-time reading from std error and output, and writing to std input.

Usage

Like this

using (var proc = new ProcessHost("my.exe", @"C:\temp\")) {
    proc.Start();
}

Or,

using (var proc = new ProcessHost(msBuildExe, projectDir)) {
    proc.Start(projectFile + " /t:Publish");
        
    int resultCode;
    if (!proc.WaitForExit(TimeSpan.FromMinutes(1), out resultCode))
    {
        proc.Kill();
        throw new Exception("Publish killed -- took too long");
    }

    File.AppendAllText(logFile, proc.StdOut.ReadAllText(Encoding.UTF8));
    File.AppendAllText(logFile, proc.StdErr.ReadAllText(Encoding.UTF8));

    if (resultCode != 0)
    {
        throw new Exception("Publish failure: see \"" + logFile + "\" for details");
    }
}

RunProcess

A process host for Windows (Vista and later) that is more reliable and flexible than System.Diagnostics.Process

Allows run-time reading from std error and output, and writing to std input.

Usage

Like this

using (var proc = new ProcessHost("my.exe", @"C:\temp\")) {
    proc.Start();
}

Or,

using (var proc = new ProcessHost(msBuildExe, projectDir)) {
    proc.Start(projectFile + " /t:Publish");
        
    int resultCode;
    if (!proc.WaitForExit(TimeSpan.FromMinutes(1), out resultCode))
    {
        proc.Kill();
        throw new Exception("Publish killed -- took too long");
    }

    File.AppendAllText(logFile, proc.StdOut.ReadAllText(Encoding.UTF8));
    File.AppendAllText(logFile, proc.StdErr.ReadAllText(Encoding.UTF8));

    if (resultCode != 0)
    {
        throw new Exception("Publish failure: see \"" + logFile + "\" for details");
    }
}

Release Notes

- Fix CPU use bug in pipe read-line
- Reduce Windows version to 5 (2000, XP)

Dependencies

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on RunProcess:

Package Downloads
LogSearchShipper
LogSearchShipper client

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.2.0 1,180 2/26/2019
1.1.0 881 6/14/2018
1.0.5 2,448 9/30/2014
1.0.4 557 9/9/2014
1.0.3 13,321 2/27/2014
1.0.2 625 9/11/2013
1.0.1 563 8/28/2013
1.0.0 606 8/28/2013