command: Make passed in env take higher priority
This MR fixes #3408 (closed) by adjusting the priority of envs for os.Environ()
and passed in envs, and a test case is added to prove this.
By the way this MR also fixes test TestNewCommandProxyEnv
, which seems intended to check proxy related envs can be whitelisted form os.Environ()
, but instead passed in the envs through argument, making the test meaningless.