Hacker News new | ask | show | jobs
by withinboredom 77 days ago
environment variables can change while the process is running and are not memory safe (though I suspect node tries to wrap it with a lock). Meaning if you check a variable at point A, enter a branch and check it again at point B ... it's not guaranteed that they will be the same value. This can cause you to enter "impossible conditions".
1 comments

Wait, is it expected for them to be able to change? According to this SO answer [0] it's only really possible through GDB or "nasty hacks" as there's no API for it.

[0] https://unix.stackexchange.com/questions/38205/change-enviro...

The process itself (including other threads) can call setenv whenever it wants.