process.envs
process.envs
Function
Set child process environment variables in batches.
Syntax
process(program).envs(values)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| values | Object | No | None | Environment variable mapping object; rules for keys and values are given below. |
values object structure
| key | value type | description |
|---|---|---|
| Environment variable name | Any | The value to be written to the subprocess environment variable; it will be converted to a string when called. |
Return value
| Type | Description |
|---|---|
| Process | Returns the new process builder. |
Example
// Set the BT_ENV environment variable for the child process. cmd = process('cmd').envs({BT_ENV: '1'}) result = cmd.get_envs() // Output: {"BT_ENV":"1"} print result
Notes
- The object value will be converted to a string first.