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

Add addenv(); a way to add new mappings into Cmd environment blocks. #37244

Merged
merged 1 commit into from
Sep 9, 2020

Conversation

staticfloat
Copy link
Member

This addresses one-half of #37070 as discussed during triage today. One slightly awkward part of this is that setenv() and addenv() don't actually mutate the cmd object passed in, so you must make sure to cmd = addenv(cmd, "FOO" => "bar"). I have made the docs as explicit as possible about this.

Copy link
Member

@DilumAluthge DilumAluthge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

If you wanted to be extra clear, you could explicitly say in the docstring "the original Cmd object will not be mutated".

NEWS.md Outdated Show resolved Hide resolved
base/cmd.jl Outdated Show resolved Hide resolved
base/cmd.jl Outdated Show resolved Hide resolved
base/cmd.jl Outdated Show resolved Hide resolved
@omus
Copy link
Member

omus commented Sep 4, 2020

I'll mention the docstring for setenv mentions using withenv. Maybe we should add a method to withenv for this instead of defining a new function? Could be something like

withenv(cmd::Cmd, env::Pair{<:AbstractString}...) -> Cmd

If having the new function addenv is preferred we should update the setenv docstring accordingly

@staticfloat staticfloat force-pushed the sf/cmd_env branch 2 times, most recently from 8df5431 to 65a4761 Compare September 9, 2020 03:29
@staticfloat staticfloat merged commit 18198b1 into master Sep 9, 2020
@staticfloat staticfloat deleted the sf/cmd_env branch September 9, 2020 07:27
@fredrikekre fredrikekre added the needs compat annotation Add !!! compat "Julia x.y" to the docstring label Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs compat annotation Add !!! compat "Julia x.y" to the docstring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants