# withEnvironment

abstract fun withEnvironment(@Nullable environmentVariables: @Nullable Map<String, String>): GradleRunner(source)

Sets the environment variables for the build. `null` is permitted and will make the build use the system environment.

When environment is specified, running with isDebug is not allowed. Debug mode runs in-process and TestKit must fork a separate process to pass environment variables.

#### Return

this

#### Since

5.2

#### Parameters

environmentVariables

the variables to use, `null` is allowed.