Keep the driver's own BASH_ENV blank out of a recorded command's env

The test double's captured environment stopped filtering the BASH_ENV
blank when fabro's exec policy stopped inserting one, but the driver's
Bash helper still records its own blank on the spec, so a test comparing
the caller's variables saw an extra entry.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-09-11 13:36:57 -06:00
parent d986fc9751
commit d9929a24d7
No known key found for this signature in database

View file

@ -280,10 +280,13 @@ impl MockSandbox {
}
/// The explicit variables of the last command as the caller passed them.
/// The driver's Bash helper records its own `BASH_ENV` blank on the
/// spec; that is not the caller's.
pub fn captured_env_vars(&self) -> Option<HashMap<String, String>> {
self.recorded().last().map(|spec| {
spec.env
.iter()
.filter(|(key, _)| key.as_str() != sandbox_driver::BASH_ENV_VAR)
.map(|(k, v)| (k.clone(), v.clone()))
.collect()
})