Execute a Shell Process in F#
Update 2022-01: Check out library Fli .
Synchronously execute a process and wait for it to return; capturing the exit code, stdout, and stderr. It’s a snippet that I often reach for but I can never find it on the internet. Dotnet makes it more difficult than it really should be.
let result = executeProcess "uptime" "-p"
printfn "Exit code: %d" result.ExitCode
printfn "StdOut: %s" result.StdOut
(*
Exit code: 0
StdOut: up 2 days, 20 hours, 55 minutes
*) …


