cli-plugins: PluginRunCommand: use cmd.Environ instead of os.Environ
Commit 50117590567998307eba377295a1ec24e214ccc7 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>
This commit is contained in:
parent
7f15dfa4d5
commit
5ccb48459b
@ -240,8 +240,7 @@ func PluginRunCommand(dockerCli command.Cli, name string, rootcmd *cobra.Command
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, ReexecEnvvar+"="+os.Args[0])
|
||||
cmd.Env = append(cmd.Environ(), ReexecEnvvar+"="+os.Args[0])
|
||||
cmd.Env = appendPluginResourceAttributesEnvvar(cmd.Env, rootcmd, plugin)
|
||||
|
||||
return cmd, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user