Closed
Description
When I run setenv
or addenv
, I was expecting its dir
does not change in this process since the only thing I want to change is ENV
. But it turns out dir
is cleared after a setenv
or an addenv
:
julia> Cmd(`ls`; dir = "/usr/local").dir
"/usr/local"
julia> setenv(Cmd(`ls`; dir = "/usr/local")).dir
""
julia> addenv(Cmd(`ls`; dir = "/usr/local")).dir
""
However, I found the flag ignorestatus
is inherited:
julia> Cmd(`ls`, dir = "/usr/local/bin", ignorestatus=true).ignorestatus
true
julia> setenv(Cmd(`ls`, dir = "/usr/local/bin", ignorestatus=true), ENV).ignorestatus
true
Should we let dir
in setenv
& addenv
defaults to cmd.dir
?
setenv(command::Cmd, env; dir=command.dir)
julia> versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)