Process

trait Process[O, E] extends ProcessLike with ProcessConfiguration

Describes a system process to be executed

This base trait is always extended with redirection and configuration capabilities represented by the traits ProcessConfiguration, RedirectableInput, RedirectableOutput and RedirectableError.

To create a process use the constructor in the companion object Process.apply.

The process specification not only encodes the process to be started but also how its input, output and error streams are redirected and executed. For this reason the effect type is also bound by the process, not just at execution time.

Type Params
E

Error output type

O

Output type

Companion
object
class Object
trait Matchable
class Any
class ProcessImplE[E]
class ProcessImplIE[E]
class ProcessImplIO[O]
class ProcessImplIOE[O, E]
class ProcessImplO[O]
class ProcessImplOE[O, E]

Type members

Types

override
type Self <: Process[O, E]

Value members

Concrete methods

def run[Info]()(implicit runner: ProcessRunner[Info]): ProxIO[ProcessResult[O, E]]

Starts the process asynchronously and blocks the execution until it is finished

Starts the process asynchronously and blocks the execution until it is finished

Value Params
runner

The process runner to be used

Returns

the result of the finished process

def start[Info]()(implicit runner: ProcessRunner[Info]): ProxResource[ProxFiber[ProcessResult[O, E]]]

Starts the process asynchronously and returns a closeable fiber representing it

Starts the process asynchronously and returns a closeable fiber representing it

Joining the fiber waits for the process to be terminated. Canceling the fiber terminates the process normally (with SIGTERM).

Value Params
runner

The process runner to be used

Returns

a managed fiber representing the running process

def startProcess[Info]()(implicit runner: ProcessRunner[Info]): ProxIO[RunningProcess[O, E, Info]]

Starts the process asynchronously and returns the RunningProcess interface for it

Starts the process asynchronously and returns the RunningProcess interface for it

This is the most advanced way to start processes. See start and run as alternatives.

Type Params
Info

The runner-specific process info type

Value Params
runner

The process runner to be used

Returns

interface for handling the running process

Inherited methods

def `with`(nameValuePair: (String, String)): Self

Adds an environment variable to the process

Adds an environment variable to the process

Value Params
nameValuePair

A pair of name and value

Returns

a new process with the working directory set

Inherited from
ProcessLikeConfiguration
override protected
def applyConfiguration(workingDirectory: Option[Path], environmentVariables: Map[String, String], removedEnvironmentVariables: Set[String]): Self
def in(workingDirectory: Path): Self

Changes the working directory of the process

Changes the working directory of the process

Value Params
workingDirectory

the working directory

Returns

a new process with the working directory set

Inherited from
ProcessLikeConfiguration

Use the inherited working directory of the process instead of an explicit one

Use the inherited working directory of the process instead of an explicit one

Returns

a new process with the working directory cleared

Inherited from
ProcessLikeConfiguration
protected
def selfCopy(command: String, arguments: List[String], workingDirectory: Option[Path], environmentVariables: Map[String, String], removedEnvironmentVariables: Set[String]): Self
Inherited from
ProcessConfiguration
def withArguments(newArguments: List[String]): Self

Replaces the arguments

Replaces the arguments

Value Params
newArguments

new list of arguments

Returns

returns a new process specification

Inherited from
ProcessConfiguration
def withCommand(newCommand: String): Self

Replaces the command

Replaces the command

Value Params
newCommand

new value for the command to be executed

Returns

returns a new process specification

Inherited from
ProcessConfiguration
def without(name: String): Self

Removes an environment variable from the process

Removes an environment variable from the process

Usable to remove variables inherited from the parent process.

Value Params
name

Name of the environment variable

Returns

a new process with the working directory set

Inherited from
ProcessLikeConfiguration

Abstract fields

val arguments: List[String]
val command: String
val environmentVariables: Map[String, String]
val runErrorStream: InputStream => ProxIO[E]
val runOutputStream: InputStream => ProxIO[O]
val workingDirectory: Option[Path]