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.appSettings key fallbackValue
Signature: key:string -> fallbackValue:string -> string []
Attributes:
[<Obsolete("This is no longer supported on dotnetcore.")>]
OBSOLETE

This is no longer supported on dotnetcore.

Process.asyncShellExec(args)
Signature: args:ExecParams -> Async<int>
Attributes:
[<Obsolete("use the CreateProcess APIs instead.")>]
OBSOLETE

use the CreateProcess APIs instead.

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
Attributes:
[<Obsolete("use the CreateProcess APIs instead.")>]
OBSOLETE

use the CreateProcess APIs instead.

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
Attributes:
[<Obsolete("use the CreateProcess APIs instead.")>]
OBSOLETE

use the CreateProcess APIs instead.

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
Attributes:
[<Obsolete("use the CreateProcess APIs instead.")>]
OBSOLETE

use the CreateProcess APIs instead.

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 = Process.execSimple (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
Attributes:
[<Obsolete("use the CreateProcess APIs instead.")>]
OBSOLETE

use the CreateProcess APIs instead.

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.findFile dirs file
Signature: dirs:seq<string> -> file:string -> string
Attributes:
[<Obsolete("Use ProcessUtils.findFile instead")>]
OBSOLETE

Use ProcessUtils.findFile instead

Process.findFiles dirs file
Signature: dirs:seq<string> -> file:string -> seq<string>
Attributes:
[<Obsolete("Use ProcessUtils.findFiles instead")>]
OBSOLETE

Use ProcessUtils.findFiles instead

Process.findFilesOnPath(file)
Signature: file:string -> seq<string>
Attributes:
[<Obsolete("Use ProcessUtils.findFilesOnPath instead")>]
OBSOLETE

Use ProcessUtils.findFilesOnPath instead

Process.findPath(...)
Signature: settingsName:string -> fallbackValue:string -> tool:string -> string
Attributes:
[<Obsolete("Use ProcessUtils.findPath instead")>]
OBSOLETE

Use ProcessUtils.findPath instead

Process.fireAndForget(...)
Signature: configProcessStartInfoF:(ProcStartInfo -> ProcStartInfo) -> unit
Attributes:
[<Obsolete("use the CreateProcess APIs instead.")>]
OBSOLETE

use the CreateProcess APIs instead.

Starts the given process and returns immediatly.

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

Returns all processes with the given name

Process.getEnvironmentVariable(...)
Signature: envKey:string -> startInfo:^a -> string option
Type parameters: ^a
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
Attributes:
[<Obsolete("use the CreateProcess APIs instead.")>]
OBSOLETE

use the CreateProcess APIs instead.

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
Attributes:
[<Obsolete("use the CreateProcess APIs instead.")>]
OBSOLETE

use the CreateProcess APIs instead.

Starts the given process and forgets about it.

Process.tryFindFile dirs file
Signature: dirs:seq<string> -> file:string -> string option
Attributes:
[<Obsolete("Use ProcessUtils.tryFindFile instead")>]
OBSOLETE

Use ProcessUtils.tryFindFile instead

Process.tryFindFileOnPath(file)
Signature: file:string -> string option
Attributes:
[<Obsolete("Use ProcessUtils.tryFindFileOnPath instead")>]
OBSOLETE

Use ProcessUtils.tryFindFileOnPath instead

Process.tryFindPath(...)
Signature: settingsName:string -> fallbackValue:string -> tool:string -> string option
Attributes:
[<Obsolete("Use ProcessUtils.tryFindPath instead")>]
OBSOLETE

Use ProcessUtils.tryFindPath instead

Process.tryFindTool envVar tool
Signature: envVar:string -> tool:string -> string option
Attributes:
[<Obsolete("Use ProcessUtils.tryFindTool instead")>]
OBSOLETE

Use ProcessUtils.tryFindTool instead

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'.