Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does setenv & thus addenv discard the cmd's dir? #42131

Closed
singularitti opened this issue Sep 5, 2021 · 2 comments · Fixed by #43276
Closed

Why does setenv & thus addenv discard the cmd's dir? #42131

singularitti opened this issue Sep 5, 2021 · 2 comments · Fixed by #43276
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@singularitti
Copy link
Contributor

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)
@singularitti singularitti changed the title Why does setenv & thus addenv discard the cmd's `dir? Why does setenv & thus addenv discard the cmd's dir? Sep 5, 2021
singularitti added a commit to MineralsCloud/QuantumESPRESSOCommands.jl that referenced this issue Sep 5, 2021
@fredrikekre fredrikekre added the bug Indicates an unexpected problem or unintended behavior label Sep 5, 2021
@StefanKarpinski
Copy link
Member

@Keno, I assume this is unintentional?

@vtjnash
Copy link
Member

vtjnash commented Sep 9, 2021

Seems to have been an oversight in dee7f6c, when the argument was added

KristofferC pushed a commit that referenced this issue Jan 10, 2022
KristofferC pushed a commit that referenced this issue Mar 15, 2022
KristofferC pushed a commit that referenced this issue Mar 16, 2022
staticfloat pushed a commit that referenced this issue Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants