https://github.com/i-e-b/runprocess
Replacement for System.Diagnostics.Process
https://github.com/i-e-b/runprocess
c-sharp processes win32 working
Last synced: about 1 year ago
JSON representation
Replacement for System.Diagnostics.Process
- Host: GitHub
- URL: https://github.com/i-e-b/runprocess
- Owner: i-e-b
- License: bsd-3-clause
- Created: 2013-02-13T15:33:49.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2021-07-16T10:13:48.000Z (almost 5 years ago)
- Last Synced: 2025-03-26T02:51:09.724Z (about 1 year ago)
- Topics: c-sharp, processes, win32, working
- Language: C#
- Homepage:
- Size: 204 KB
- Stars: 17
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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.
The .Net Standard build has a few less features, but will fall-back to `System.Diagnostics.Process` on non-Windows systems.
Usage
-----
Like this
```csharp
using (var proc = new ProcessHost("my.exe", @"C:\temp\")) {
proc.Start();
}
```
Or,
```csharp
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");
}
}
```