We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12f730b commit 076f27fCopy full SHA for 076f27f
2 files changed
README.md
@@ -36,6 +36,7 @@ Default option functions:
36
- `cmd.WithTimeout(time.Duration)`
37
- `cmd.WithoutTimeout`
38
- `cmd.WithWorkingDir(string)`
39
+ - `cmd.WithEnvironment`
40
41
#### Example
42
command.go
@@ -95,6 +95,11 @@ func WithWorkingDir(dir string) func(c *Command) {
95
}
96
97
98
+// WithEnvironment adds all environments from the current process to the command
99
+func WithEnvironment(c *Command) {
100
+ c.Env = os.Environ()
101
+}
102
+
103
// AddEnv adds an environment variable to the command
104
// If a variable gets passed like ${VAR_NAME} the env variable will be read out by the current shell
105
func (c *Command) AddEnv(key string, value string) {
0 commit comments