-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Remove tracking of environment from osenv.nim v2 #18575
Conversation
63de29f
to
9b4d4fd
Compare
9b4d4fd
to
86f54d2
Compare
Does this code still work? putEnv("key", "value")
assert getEnv("key") == "value"
Because 11 years ago when I wrote the code, it didn't and I had to come up with the |
yes, i just double-checked; if that didn't work nothing would; more importantly, it's covered in the tests, see tosenv.nim which has increased coverage compared to before this PR (c,cpp,js,vm + threads + more testing) EDIT: #18530 (which was merged last week) is also an ingredient that makes this work, by avoiding having to hold on to the strings by using setenv instead of putenv. |
@Araq PTAL |
* Remove unnecessary environment tracking * try to fix windows * fix delEnv * make putEnv work on windows even with empty values; improve tests: add tests, add js, vm testing * [skip ci] fix changelog Co-authored-by: Caden Haustein <[email protected]>
getEnv
+ friends gives SIGSEGV or wrong results; osenv should not try to keep track ofenvironment
#18533the 1st commit is squashed from #18535 and keeps the author's name
note
code to support empty values on windows (
putEnv("foo", "")
) is inspired from facebook/folly@5d8ca09, see also https://github.com/facebook/folly/blob/master/folly/portability/Stdlib.cppthis is the best approach I found after extensive research; it allows having same semantics across backends (c,cpp,js,vm) and os's (osx, linux, windows)
future work
envPairs
(via an intermediate seq, like for walkFiles iterator etc)=> tracked in envPairs works in vm, nims #18615
links