# Interface ProcessForkOptions

All Known Subinterfaces:
  `BaseExecSpec, ExecSpec, JavaExecSpec, JavaForkOptions`

All Known Implementing Classes:
  `AbstractExecTask, Exec, JavaExec, RunTestExecutable, Test`

public interface ProcessForkOptions

Specifies the options to use to fork a process.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ProcessForkOptions`
  `copyTo(ProcessForkOptions options)`
  Copies these options to the given target options.
  `ProcessForkOptions`
  `environment(String name, Object value)`
  Adds an environment variable to the environment for this process.
  `ProcessForkOptions`
  `environment(Map<String,?> environmentVariables)`
  Adds some environment variables to the environment for this process.
  `ProcessForkOptions`
  `executable(Object executable)`
  Sets the name of the executable to use.
  `Map<String,Object>`
  `getEnvironment()`
  The environment variables to use for the process.
  `String`
  `getExecutable()`
  Returns the name of the executable to use.
  `File`
  `getWorkingDir()`
  Returns the working directory for the process.
  `DirectoryProperty`
  `getWorkingDirectory()`
  Returns the working directory for the process as a `DirectoryProperty`.
  `void`
  `setEnvironment(Map<String,?> environmentVariables)`
  Sets the environment variable to use for the process.
  `void`
  `setExecutable(Object executable)`
  Sets the name of the executable to use.
  `void`
  `setExecutable(String executable)`
  Sets the name of the executable to use.
  `void`
  `setWorkingDir(File dir)`
  Sets the working directory for the process.
  `void`
  `setWorkingDir(Object dir)`
  Sets the working directory for the process.
  `ProcessForkOptions`
  `workingDir(Object dir)`
  Sets the working directory for the process.

- ## Method Details

  - ### getExecutable

    String getExecutable()
    Returns the name of the executable to use.
    Returns:
      The executable.

  - ### setExecutable

    void setExecutable(String executable)
    Sets the name of the executable to use.
    Parameters:
      `executable` - The executable. Must not be null.
    Since:
      4.0

  - ### setExecutable

    void setExecutable(Object executable)
    Sets the name of the executable to use.
    Parameters:
      `executable` - The executable. Must not be null.

  - ### executable

    ProcessForkOptions executable(Object executable)
    Sets the name of the executable to use.
    Parameters:
      `executable` - The executable. Must not be null.
    Returns:
      this

  - ### getWorkingDir

    @ReplacedBy("workingDirectory") File getWorkingDir()
    Returns the working directory for the process. Defaults to the project directory.
    Returns:
      The working directory. Never returns null.

  - ### setWorkingDir

    void setWorkingDir(File dir)
    Sets the working directory for the process.
    Parameters:
      `dir` - The working directory. Must not be null.
    Since:
      4.0

  - ### setWorkingDir

    void setWorkingDir(Object dir)
    Sets the working directory for the process. The supplied argument is evaluated as per `Project.file(Object)`.
    Parameters:
      `dir` - The working directory. Must not be null.

  - ### workingDir

    ProcessForkOptions workingDir(Object dir)
    Sets the working directory for the process. The supplied argument is evaluated as per `Project.file(Object)`.
    Parameters:
      `dir` - The working directory. Must not be null.
    Returns:
      this

  - ### getWorkingDirectory

    @Incubating @Internal DirectoryProperty getWorkingDirectory()
    Returns the working directory for the process as a `DirectoryProperty`. Defaults to the project directory.
    Returns:
      The working directory property. Must not be unset.
    Since:
      9.7.0

  - ### getEnvironment

    Map<String,Object> getEnvironment()
    The environment variables to use for the process. Defaults to the environment of this process.
    Returns:
      The environment. Returns an empty map when there are no environment variables.

  - ### setEnvironment

    void setEnvironment(Map<String,?> environmentVariables)
    Sets the environment variable to use for the process.
    Parameters:
      `environmentVariables` - The environment variables. Must not be null.

  - ### environment

    ProcessForkOptions environment(Map<String,?> environmentVariables)
    Adds some environment variables to the environment for this process.
    Parameters:
      `environmentVariables` - The environment variables. Must not be null.
    Returns:
      this

  - ### environment

    ProcessForkOptions environment(String name, Object value)
    Adds an environment variable to the environment for this process.
    Parameters:
      `name` - The name of the variable.
      `value` - The value for the variable. Must not be null.
    Returns:
      this

  - ### copyTo

    ProcessForkOptions copyTo(ProcessForkOptions options)
    Copies these options to the given target options.
    Parameters:
      `options` - The target options
    Returns:
      this