Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion crates/bashkit/src/builtins/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,17 @@ impl Builtin for Python {
));
};

// Merge env and variables so exported vars (set via `export`) are visible
// to Python's os.getenv(). Variables override env (bash semantics).
let mut merged_env = ctx.env.clone();
merged_env.extend(ctx.variables.iter().map(|(k, v)| (k.clone(), v.clone())));

run_python(
&code,
&filename,
ctx.fs.clone(),
ctx.cwd,
ctx.env,
&merged_env,
&self.limits,
)
.await
Expand Down
2 changes: 0 additions & 2 deletions crates/bashkit/tests/spec_cases/python/python.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ print(a, b, c)"
### end

### python3_nested_dict_access
### skip: Monty dict literal in bash quoting needs single-quote support
# Nested data structures
python3 -c "data = {'users': [{'name': 'Alice'}]}
print(data['users'][0]['name'])"
Expand Down Expand Up @@ -511,7 +510,6 @@ print(count)"
### end

### python3_vfs_getenv
### skip: export propagation to ctx.env may not work in spec test runner
# Read environment variables from Python
export MY_TEST_VAR=hello_from_env
python3 -c "import os
Expand Down
Loading