Note: This is the migration API reference for FAKE 5. The new (modularized) API documentation can be found here. If the API is already migrated you can check here if exists in a module. More information regarding the migration can be found here

Process

Nested types and modules

TypeDescription
ConsoleMessage
OBSOLETE

use Fake.Core.ConsoleMessage instead

ExecParams
OBSOLETE

use Fake.Core.ExecParams instead

ProcStartInfo
OBSOLETE

use Fake.Core.ProcStartInfo instead

ProcessList
ProcessResult
OBSOLETE

use Fake.Core.ProcessResult instead

Functions and values

Function or valueDescription
Process.AlwaysSetProcessEncoding
Signature: bool

If set to true the ProcessHelper will start all processes with a custom ProcessEncoding. If set to false (default) only mono processes will be changed.

Process.asyncShellExec(args)
Signature: args:ExecParams -> Async<int>

Execute an external program asynchronously and return the exit code, logging output and error messages to FAKE output. You can compose the result with Async.Parallel to run multiple external programs at once, but be sure that none of them depend on the output of another.

Process.createEnvironmentMap()
Signature: unit -> Map<string,string>
Process.defaultEnvVar
Signature: string
Process.directExec(...)
Signature: configProcessStartInfoF:(ProcStartInfo -> ProcStartInfo) -> bool

Runs the given process, waits for its completion and returns if it succeeded.

Process.disableRedirectOutput(startInfo)
Signature: startInfo:^a -> ^a
Type parameters: ^a
Process.disableShellExecute(startInfo)
Signature: startInfo:ProcStartInfo -> ProcStartInfo
Process.ensureProcessesHaveStopped(...)
Signature: name:string -> timeout:TimeSpan -> unit

Waits until the processes with the given name have stopped or fails after given timeout.

Parameters

  • name - The name of the processes in question.
  • timeout - The timespan to time out after.
Process.execElevated cmd args timeOut
Signature: cmd:string -> args:string -> timeOut:TimeSpan -> int
Attributes:
[<Obsolete("This is currently not possible in dotnetcore")>]
OBSOLETE

This is currently not possible in dotnetcore

Runs the given process in an elevated context and returns the exit code.

Parameters

  • cmd - The command which should be run in elavated context.
  • args - The process arguments.
  • timeOut - The timeout for the process.
Process.execRaw(...)
Signature: configProcessStartInfoF:(ProcStartInfo -> ProcStartInfo) -> timeOut:TimeSpan -> silent:bool -> errorF:(string -> unit) -> messageF:(string -> unit) -> int

Runs the given process and returns the exit code.

Parameters

  • configProcessStartInfoF - A function which overwrites the default ProcessStartInfo.
  • timeOut - The timeout for the process.
  • silent - If this flag is set then the process output is redirected to the given output functions errorF and messageF.
  • errorF - A function which will be called with the error log.
  • messageF - A function which will be called with the message log.
Process.execSimple(...)
Signature: configProcessStartInfoF:(ProcStartInfo -> ProcStartInfo) -> timeOut:TimeSpan -> int

Runs the given process and returns the exit code.

Parameters

  • configProcessStartInfoF - A function which overwrites the default ProcessStartInfo.

  • timeOut - The timeout for the process.

    Sample

    let result = ExecProcess (fun info ->
    info.FileName <- "c:/MyProc.exe" info.WorkingDirectory <- "c:/workingDirectory" info.Arguments <- "-v") (TimeSpan.FromMinutes 5.0)

    if result <> 0 then failwithf "MyProc.exe returned with a non-zero exit code"

Process.execWithResult(...)
Signature: configProcessStartInfoF:(ProcStartInfo -> ProcStartInfo) -> timeOut:TimeSpan -> ProcessResult

Runs the given process and returns the process result.

Parameters

  • configProcessStartInfoF - A function which overwrites the default ProcessStartInfo.
  • timeOut - The timeout for the process.
Process.findFilesOnPath(file)
Signature: file:string -> seq<string>

Searches in PATH for the given file and returnes the result ordered by precendence

Process.fireAndForget(...)
Signature: configProcessStartInfoF:(ProcStartInfo -> ProcStartInfo) -> unit

Starts the given process and returns immediatly.

Process.getAllByName(name)
Signature: name:string -> seq<Process>

Returns all processes with the given name

Process.getFileName(p)
Signature: p:Process -> string

Retrieve the file-path of the running executable of the given process.

Process.getProc(config)
Signature: config:(ProcStartInfo -> ProcStartInfo) -> Process
Process.getProcessesByName(name)
Signature: name:string -> seq<Process>
Attributes:
[<Obsolete("use Process.getAllByName instead.")>]
OBSOLETE

use Process.getAllByName instead.

Process.getRedirectOutputToTrace()
Signature: unit -> bool
Process.kill(proc)
Signature: proc:Process -> unit

Kills the given process

Process.killAllByName(name)
Signature: name:string -> unit

Kills all processes with the given name

Process.killAllCreatedProcesses()
Signature: unit -> unit

Kills all processes that are created by the FAKE build script unless "donotkill" flag was set.

Process.killById(id)
Signature: id:int -> unit

Kills all processes with the given id

Process.killFSI()
Signature: unit -> unit

Kills the F# Interactive (FSI) process.

Process.killMSBuild()
Signature: unit -> unit

Kills the MSBuild process.

Process.killProcess(name)
Signature: name:string -> unit
Attributes:
[<Obsolete("use Process.killAllByName instead.")>]
OBSOLETE

use Process.killAllByName instead.

Process.killProcessById(id)
Signature: id:int -> unit
Attributes:
[<Obsolete("use Process.killById instead.")>]
OBSOLETE

use Process.killById instead.

Process.monoVersion
Signature: (string * Version option) option
Process.ProcessEncoding
Signature: Encoding

If AlwaysSetProcessEncoding is set to false (default) only mono processes will be changed.

Process.redirectOutput(startInfo)
Signature: startInfo:^a -> ^a
Type parameters: ^a
Process.removeEnvironmentVariable(...)
Signature: envKey:string -> startInfo:^a -> ^a
Type parameters: ^a

Unsets the given environment variable for the started process

Process.setCurrentEnvironmentVariables(...)
Signature: startInfo:^a -> ^a
Type parameters: ^a

Sets all current environment variables to their current values

Process.setEnableProcessTracing
Signature: bool -> unit
Process.setEnvironment map startInfo
Signature: map:Map<string,string> -> startInfo:^a -> ^a
Type parameters: ^a
Process.setEnvironmentVariable(...)
Signature: envKey:string -> envVar:string -> startInfo:^a -> ^a
Type parameters: ^a

Sets the given environment variable for the given startInfo. Existing values will be overriden.

Process.setEnvironmentVariables(...)
Signature: vars:seq<string * string> -> startInfo:^a -> ^a
Type parameters: ^a

Sets the given environment variables.

Process.setKillCreatedProcesses(enable)
Signature: enable:bool -> unit
Process.setRedirectOutput(...)
Signature: shouldRedirect:bool -> startInfo:^a -> ^a
Type parameters: ^a
Process.setRedirectOutputToTrace
Signature: bool -> unit
Process.shouldEnableProcessTracing()
Signature: unit -> bool
Process.shouldKillCreatedProcesses()
Signature: unit -> bool
Process.start(configProcessStartInfoF)
Signature: configProcessStartInfoF:(ProcStartInfo -> ProcStartInfo) -> unit

Starts the given process and forgets about it.

Process.tryFindFileOnPath(file)
Signature: file:string -> string option

Searches the current directory and the directories within the PATH environment variable for the given file. If successful returns the full path to the file.

Parameters

  • file - The file to locate
Process.tryFindTool envVar tool
Signature: envVar:string -> tool:string -> string option

Tries to find the tool via Env-Var. If no path has the right tool we are trying the PATH system variable.

Process.withFramework(proc)
Signature: proc:ProcStartInfo -> ProcStartInfo

Ensures the executable is run with the full framework. On non-windows platforms that means running the tool by invoking 'mono'.