https://github.com/JuliaLang/julia
Revision 722467136eb52b4ca499ae8065636757d2195cee authored by Elliot Saba on 07 January 2021, 16:55:50 UTC, committed by KristofferC on 08 January 2021, 09:04:59 UTC
The spirit of `addenv()` is to be non-destructive, however because a
`Cmd` object with an `env` member that is set to `nothing` (the default)
inherts from the current environment when it is run.  This means that
the following, rather surprising behavior holds true on current master:

```
julia> ENV["FOO"] = "foo"
       run(`/bin/bash -c "echo \$FOO \$BAR"`)
       run(addenv(`/bin/bash -c "echo \$FOO \$BAR"`, "BAR" => "bar"))
foo
bar
```

This PR adds an `inherit` flag to `addenv()` to allow keeping this
behavior if it is actually desired (this might make sense if you are
constructing `.env` blocks over a series of `addenv()` calls and you
don't want to have to special-case your first operation as a `setenv()`
rather than an `addenv()`.

(cherry picked from commit fa14d0b449451208ec4aed1d4a35aa993d65e398)
1 parent d89e619
History
Tip revision: 722467136eb52b4ca499ae8065636757d2195cee authored by Elliot Saba on 07 January 2021, 16:55:50 UTC
`addenv()`, by default, should inherit from `ENV` (#39100)
Tip revision: 7224671
File Mode Size
.devcontainer
base
cli
contrib
deps
doc
etc
src
stdlib
test
.clang-format -rw-r--r-- 3.3 KB
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 283 bytes
.mailmap -rw-r--r-- 11.0 KB
CITATION.bib -rw-r--r-- 2.6 KB
CONTRIBUTING.md -rw-r--r-- 19.9 KB
HISTORY.md -rw-r--r-- 292.0 KB
LICENSE.md -rw-r--r-- 5.0 KB
Make.inc -rw-r--r-- 49.5 KB
Makefile -rw-r--r-- 25.2 KB
NEWS.md -rw-r--r-- 21.1 KB
README.md -rw-r--r-- 6.9 KB
VERSION -rw-r--r-- 10 bytes
sysimage.mk -rw-r--r-- 3.9 KB

README.md

back to top