Asmichi.ChildProcess
0.3.0
See the version list below for details.
dotnet add package Asmichi.ChildProcess --version 0.3.0
NuGet\Install-Package Asmichi.ChildProcess -Version 0.3.0
<PackageReference Include="Asmichi.ChildProcess" Version="0.3.0" />
<PackageVersion Include="Asmichi.ChildProcess" Version="0.3.0" />
<PackageReference Include="Asmichi.ChildProcess" />
paket add Asmichi.ChildProcess --version 0.3.0
#r "nuget: Asmichi.ChildProcess, 0.3.0"
#:package Asmichi.ChildProcess@0.3.0
#addin nuget:?package=Asmichi.ChildProcess&version=0.3.0
#tool nuget:?package=Asmichi.ChildProcess&version=0.3.0
Asmichi.ChildProcess
A .NET library that provides functionality for creating child processes. Easier, less error-prone, more flexible than System.Diagnostics.Process at creating child processes.
This library can be obtained via NuGet.
Comparison with System.Diagnostics.Process
- Concentrates on creating a child process and obtaining its output.
- Cannot query status of a process.
- More destinations of redirection:
- NUL
- File (optionally appended)
- Pipe
- Handle
- Less error-prone default values for redirection:
- stdin to NUL
- stdout to the current stdout
- stderr to the current stderr
- Pipes are asynchronous; asynchronous reads and writes will be handled by IO completion ports.
WaitForExitAsync.
License
Supported Runtimes
- .NET Core 3.1 or later
OS:
win10-x86(1803 or later)win10-x64(1803 or later)linux-x64linux-arm(Not tested)linux-aarch64(Not tested)
NOTE: On Linux, the system must have GLIBC 2.x.y or later and LIBSTDCXX 3.x.y or later. Musl-based Linux (Alpine, etc.) is not currently supported.
Notes
- When overriding environment variables, it is recommended that you include basic environment variables such as
SystemRoot, etc.
Assumptions on Runtimes
This library assumes that the underlying runtime has the following characteristics:
- Windows
- The inner value of a
SafeFileHandleis a file handle. - The inner value of a
SafeWaitHandleis a handle thatWaitForSingleObjectcan wait for. - The inner value of a
SafeProcessHandleis a process handle.
- The inner value of a
- *nix
- The inner value of a
SafeFileHandleis a file descriptor. - The inner value of a
SafeProcessHandleis a process id. Socket.Handlereturns a socket file descriptor.
- The inner value of a
Limitations
- More than 2^63 processes cannot be created.
Examples
See ChildProcess.Example for more examples.
Basic
var si = new ChildProcessStartInfo("cmd", "/C", "echo", "foo")
{
StdOutputRedirection = OutputRedirection.OutputPipe,
};
using (var p = ChildProcess.Start(si))
{
using (var sr = new StreamReader(p.StandardOutput))
{
// "foo"
Console.Write(await sr.ReadToEndAsync());
}
await p.WaitForExitAsync();
// ExitCode: 0
Console.WriteLine("ExitCode: {0}", p.ExitCode);
}
Redirection to File
var si = new ChildProcessStartInfo("cmd", "/C", "set")
{
StdOutputRedirection = OutputRedirection.File,
StdOutputFile = "env.txt"
};
using (var p = ChildProcess.Start(si))
{
await p.WaitForExitAsync();
}
// ALLUSERSPROFILE=C:\ProgramData
// ...
Console.WriteLine(File.ReadAllText("env.txt"));
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Asmichi.ChildProcess:
| Package | Downloads |
|---|---|
|
OneWare.Essentials
Essentials Needed for One Ware Plugin Development |
|
|
Sisk.Helpers.mitmproxy
Provides an interface to access Sisk through mitmproxy. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Asmichi.ChildProcess:
| Repository | Stars |
|---|---|
|
sisk-http/core
Sisk's request and response processor mainframe source code.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 0.18.0 | 9,304 | 9/22/2024 |
| 0.17.0 | 1,335 | 6/29/2024 |
| 0.16.0 | 893 | 4/28/2024 |
| 0.15.0 | 247 | 3/16/2024 |
| 0.14.0 | 3,120 | 5/3/2023 |
| 0.13.0 | 911 | 6/19/2022 |
| 0.12.0 | 723 | 2/23/2022 |
| 0.11.0 | 727 | 9/14/2021 |
| 0.10.0 | 506 | 8/31/2021 |
| 0.9.0 | 556 | 7/28/2021 |
| 0.8.0 | 598 | 7/3/2021 |
| 0.7.0 | 518 | 6/8/2021 |
| 0.6.0 | 635 | 2/28/2021 |
| 0.5.2 | 607 | 2/23/2021 |
| 0.4.0 | 553 | 2/14/2021 |
| 0.3.0 | 660 | 11/25/2020 |
| 0.2.0 | 722 | 10/17/2020 |