mirror of https://github.com/docker/cli.git
cli-plugins: PluginRunCommand: use cmd.Environ instead of os.Environ
Commit5011759056
implemented a fix that caused the current environment to be discarded, using `os.Environ()`. On Windows, `os.Environ()` may produce an incorrect value for `PWD`, for which a new function was added in go1.19; - https://tip.golang.org/doc/go1.19#osexecpkgosexec - https://go-review.googlesource.com/c/go/+/401340 Replace the use of `os.Environ()` with `cmd.Environ()` to address that. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit5ccb48459b
) Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
1e6db5d24b
commit
1c6a8ecf2e
|
@ -240,8 +240,7 @@ func PluginRunCommand(dockerCli command.Cli, name string, rootcmd *cobra.Command
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = append(cmd.Environ(), ReexecEnvvar+"="+os.Args[0])
|
||||||
cmd.Env = append(cmd.Env, ReexecEnvvar+"="+os.Args[0])
|
|
||||||
cmd.Env = appendPluginResourceAttributesEnvvar(cmd.Env, rootcmd, plugin)
|
cmd.Env = appendPluginResourceAttributesEnvvar(cmd.Env, rootcmd, plugin)
|
||||||
|
|
||||||
return cmd, nil
|
return cmd, nil
|
||||||
|
|
Loading…
Reference in New Issue