diff options
| author | Jonas Maier <jonas@x77.dev> | 2026-05-12 21:27:52 +0200 |
|---|---|---|
| committer | Jonas Maier <jonas@x77.dev> | 2026-05-12 21:27:52 +0200 |
| commit | 116b0ac3c99fd317d3800637ca3f88f4d3874c1b (patch) | |
| tree | 29982dbac0ed23275c960ff1be24600e7468cbf6 /src/run/mod.rs | |
| parent | 0e5d95663aaac8b7368c82290476694b561536d3 (diff) | |
| download | pish-116b0ac3c99fd317d3800637ca3f88f4d3874c1b.tar.gz | |
variable refactor: export builtin
Diffstat (limited to 'src/run/mod.rs')
| -rw-r--r-- | src/run/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/run/mod.rs b/src/run/mod.rs index 55bdd29..8be5fca 100644 --- a/src/run/mod.rs +++ b/src/run/mod.rs @@ -262,6 +262,11 @@ impl Executor { crate::export_fun::prepare_command(self.se.clone(), &mut command); + command.env_clear(); + for (var, val) in self.se.lock().unwrap().vars.export() { + command.env(OsStr::from_bytes(var), OsStr::from_bytes(val.as_ref())); + } + match command.spawn() { Ok(c) => SpawnedCmd::Child(ChildWaiter::new(c).unwrap()), Err(e) => SpawnedCmd::SpawnError(e), @@ -478,7 +483,7 @@ impl parse::Expander for Executor { } if let Some(val) = self.se.lock().unwrap().vars.lookup(&var) { - return Ok(val); + return Ok(val.into_owned()); } if let Some(dfl) = default { @@ -697,6 +702,7 @@ const BUILTINS: &[&'static dyn BuiltinClone] = &[ &builtin::Continue, &builtin::Here, &builtin::logo, + &builtin::export, ]; pub fn builtin_map() -> HashMap<BString, &'static dyn BuiltinClone> { |
