diff options
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> { |
