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
tidy: clean up code for env loader #9642
base: main
Are you sure you want to change the base?
Conversation
❌ @paperdave 2 files with test failures on linux-x64-baseline: |
❌ @paperdave 3 files with test failures on linux-x64: |
❌🪟 @paperdave, there are 10 test regressions on Windows x86_64
|
❌ @paperdave 7 files with test failures on bun-darwin-aarch64:
|
❌ @paperdave 5 files with test failures on bun-darwin-x64: |
createNullDelimitedEnvMap
this structure had a single field in it
Nice |
@@ -391,18 +391,19 @@ pub const LifecycleScriptSubprocess = struct { | |||
this.stderr.deinit(); | |||
} | |||
|
|||
this.env.deinit(this.manager.allocator); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
@paperdave I'm glad you caught this. I'm wary of our policy of recreating the wheel of APIs that exist in the platform in part because of things like this that fall through the cracks. I'd rather contribute to fixing the lower level APIs where possible and deviating from them only when reaaally needed. |
What does this PR do?
Fixes #9635
Fixes #9445
Supercedes #9448
When we moved from
std.process
to our own spawn implementation, we moved fromstdEnvMap
tocreateNullDelimitedEnvMap
in many places. i would like to highlight one line of the former:Such check is not present in
createNullDelimitedEnvMap
. We started passing a bunch of.conditional = true
variables to subprocesses.This PR removes .conditional and changes
HashTableValue
into juststring
. then, instead of loading variables that never get passed to subprocess, let's just not load them. the code reads much nicer.After adding this check, it works, however this
.conditional = true
flag does not make any sense to me. I detail some more about this issue in this comment which is worth reading to get an understanding of the broken behavior this fixes.As for
createNullDelimitedEnvMap
, when i made the change, i also turned the entire operation into a single allocation, instead of many smaller ones. This will make the memory easier to free (it is still a memory leak... maybe i fix)I verify this code works by having many new tests, all of which i verify work on Bun 1.0.33, a commit before the regression.