Skip to content

sajagi/Sajagi.Exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sajagi.Exec

NuGet Version and Downloads count

Usage

module Examples

// ---------------------------------------------------------------------------------------------
// High-level API
open Sajagi.Exec

let dotnetPath = where "dotnet"

// exit code is checked by default
exec dotnetPath "build --configuration Release --output \"out\" \"src/Awesome.csproj\""
execArgs dotnetPath ["build"; "--configuration"; "Release"; "--output"; "out"; "src/Awesome.csproj"]

execAsync dotnetPath "run" |> Async.RunSynchronously
execArgsAsync dotnetPath ["run"] |> Async.RunSynchronously

// capture output
let output = execWithOutput @"C:\Windows\System32\cmd.exe" "/c echo Hello!"


// ---------------------------------------------------------------------------------------------
// Mid-level API
let dotnet = Executable(dotnetPath)

// handle exit code errors, capture error output
let result = dotnet.run("run", startOpts = { defaultStartOpts with ErrorOutput = Capture }, waitOpts = { defaultWaitOpts with ExpectedExitCode = None })
if result.ExitCode <> 0 then failwith $"dotnet run failed with exit code %d{result.ExitCode} and error: {result.ErrorOutput.StringOutput}"


// ---------------------------------------------------------------------------------------------
// Low-level API

let running = ExecRaw.start defaultStartOpts dotnetPath (ExecRaw.ExeArgs.Raw "run")
let waitResult = running |> ExecRaw.waitAsync defaultWaitOpts |> Async.RunSynchronously

printfn "Ok!"

Build

./build test
./build pack --version <version>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages