DQD.ForkPTY 1.6.0

dotnet add package DQD.ForkPTY --version 1.6.0
                    
NuGet\Install-Package DQD.ForkPTY -Version 1.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DQD.ForkPTY" Version="1.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DQD.ForkPTY" Version="1.6.0" />
                    
Directory.Packages.props
<PackageReference Include="DQD.ForkPTY" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DQD.ForkPTY --version 1.6.0
                    
#r "nuget: DQD.ForkPTY, 1.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DQD.ForkPTY@1.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DQD.ForkPTY&version=1.6.0
                    
Install as a Cake Addin
#tool nuget:?package=DQD.ForkPTY&version=1.6.0
                    
Install as a Cake Tool

DQD.ForkPTY

DQD.ForkPTY is a .NET library that bundles native binary components under the hood to enable the use of forkpty() across multiple supported platforms. Using forkpty (or fork in general) is not possible from managed code; a wrapper written in a bare metal language is needed.

Usage

  public static class Forker
  {
    public static ForkResult ForkPTYAndExec(PTYConfiguration configuration, string fileName, string?[]? argv = null);
  }

  public class PTYConfiguration
  {
    public Size CharacterSize;
    public Size PixelSize;
  }

  public struct Size
  {
    public int Width;
    public int Height;
  }

Set up a suitable PTYConfiguration instance and call Forker.ForkPTYAndExec with your designed program filename and (optional) arguments.

  • If the platform is not supported, a PlatformNotSupportedException will be thrown.
  • If an error occurs, a Win32Exception will be thrown with the captured errno value.
  • If the call succeeds, a ForkResult will be returned that contains the child process ID and a Stream wrapping its PTY.
    • ForkResult implements IDisposable and disposes the PTY stream when it is disposed.

Example

See the DQD.ForkPTY.Playground project for a simple example of use.

Contributing

Contributions -- issues, pull requests, discussion -- are welcome on the GitHub page.

License

DQD.ForkPTY is provided under the MIT open source license. See LICENSE.md for more details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.6.0 81 4/5/2026
1.5.0 79 4/5/2026
1.4.0 81 4/5/2026
1.3.0 106 4/4/2026
1.2.0 80 4/4/2026
1.1.0 91 3/29/2026
1.0.2 87 3/29/2026