Proc.Fs 0.8.2

dotnet add package Proc.Fs --version 0.8.2                
NuGet\Install-Package Proc.Fs -Version 0.8.2                
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="Proc.Fs" Version="0.8.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Proc.Fs --version 0.8.2                
#r "nuget: Proc.Fs, 0.8.2"                
#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.
// Install Proc.Fs as a Cake Addin
#addin nuget:?package=Proc.Fs&version=0.8.2

// Install Proc.Fs as a Cake Tool
#tool nuget:?package=Proc.Fs&version=0.8.2                

Proc.Fs

F# bindings for Proc.

Proc is a library that turns System.Diagnostics.Process into a stream based IObservable capable of capturing a process's true output while still emitting line based events.

The library ships with two computation expression builders:

Shell

Under development but this allows you to easily chain several process invocations where execution will stop if any process yields an exit_code other than 0

let _ = shell {
    exec "dotnet" "--version"
    exec "uname"
}

Exec

A CE to make it REAL easy to execute processes.

//executes dotnet --help
exec { run "dotnet" "--help" }

//supports lists as args too
exec { run "dotnet" ["--help"] }

If you want more info about the invocation you can use either exit_code_of or output_of for the quick one liners.

let exitCode = exec { exit_code_of "dotnet" "--help" }
let output = exec { output_of "dotnet" "--help" }

output will hold both the exit code and the console output

If you need more control on how the process is started you can supply the following options.

exec {
    binary "dotnet"
    arguments "--help"
    env Map[("key", "value")]
    workingDirectory "."
    send_control_c false
    timeout (TimeSpan.FromSeconds(10))
    thread_wrap false
    filter_output (fun l -> l.Line.Contains "clean")
    validExitCode (fun i -> i <> 0)
    run
}

run will kick off the invocation of the process.

However there are other ways to kick this off too.

exec {
    binary "dotnet"
    run_args ["restore"; "--help"]
}

Shortcut to supply arguments AND run

let linesContainingClean = exec {
    binary "dotnet"
    arguments "--help"
    filter (fun l -> l.Line.Contains "clean")
}

run the process returning only the console out matching the filter if you want to actually filter what gets written to the console use filter_output.


let dotnetHelpExitCode = exec {
    binary "dotnet"
    arguments "--help"
    exit_code
}

returns just the exit code


let helpOutput = exec {
    binary "dotnet"
    arguments "--help"
    output
}

returns the exit code and the full console output.


let process = exec {
    binary "dotnet"
    arguments "--help"
    wait_until (fun l -> l.Line.Contains "clean")
}

returns an already running process but only after it confirms a line was printed


let process = exec {
    binary "dotnet"
    arguments "--help"
    wait_until_and_disconnect (fun l -> l.Line.Contains "clean")
}

returns an already running process but only after it confirms a line was printed. This version will stop the yielding standard/out lines which may utilize memory consumption which is no longer needed.

Product 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.8.2 119 10/2/2024
0.8.1 1,255 1/16/2024
0.8.0 106 1/15/2024
0.7.3 127 1/8/2024
0.7.2 233 1/7/2024
0.7.1 115 1/6/2024
0.7.0 121 1/5/2024