File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ Default option functions:
3636 - ` cmd.WithTimeout(time.Duration) `
3737 - ` cmd.WithoutTimeout `
3838 - ` cmd.WithWorkingDir(string) `
39+ - ` cmd.WithEnvironment `
3940
4041#### Example
4142
Original file line number Diff line number Diff line change @@ -95,6 +95,11 @@ func WithWorkingDir(dir string) func(c *Command) {
9595 }
9696}
9797
98+ // WithEnvironment adds all environments from the current process to the command
99+ func WithEnvironment (c * Command ) {
100+ c .Env = os .Environ ()
101+ }
102+
98103// AddEnv adds an environment variable to the command
99104// If a variable gets passed like ${VAR_NAME} the env variable will be read out by the current shell
100105func (c * Command ) AddEnv (key string , value string ) {
You can’t perform that action at this time.
0 commit comments