diff --git a/crates/nu-cli/src/env/environment.rs b/crates/nu-cli/src/env/environment.rs index a30224e7b9..18347ec8a4 100644 --- a/crates/nu-cli/src/env/environment.rs +++ b/crates/nu-cli/src/env/environment.rs @@ -4,11 +4,9 @@ use nu_protocol::{UntaggedValue, Value}; use std::collections::{HashMap}; use std::ffi::OsString; use std::fmt::Debug; -use std::fs::OpenOptions; use std::fs::File; use std::io::prelude::*; use std::path::PathBuf; -use std::io::Write; pub trait Env: Debug + Send { fn env(&self) -> Option; @@ -87,14 +85,6 @@ impl Environment { let toml_doc = contents.parse::().unwrap(); let nurc_vars = toml_doc.get("env").unwrap().as_table().unwrap(); - let mut file = OpenOptions::new() - .write(true) - .append(true) - .create(true) - .open("env.txt").unwrap(); - - write!(&mut file, "keys to add: {:?}\n", nurc_vars).unwrap(); - nurc_vars.iter().for_each(|(k, v)| { self.add_env(k, v.as_str().unwrap()); }); @@ -133,13 +123,6 @@ impl Environment { } } - let mut file = OpenOptions::new() - .write(true) - .append(true) - .create(true) - .open("env.txt")?; - - write!(&mut file, "keys to remove: {:?}\n", vars_to_delete).unwrap(); vars_to_delete.iter().for_each(|env_var| self.remove_env(env_var)); self.nurc_env_keys = new_nurc_env_vars; @@ -154,6 +137,7 @@ impl Environment { { envs.entries.remove(key); + std::env::remove_var(key); } } diff --git a/crates/nu-cli/src/env/environment_syncer.rs b/crates/nu-cli/src/env/environment_syncer.rs index 3570896b29..f23a5fc757 100644 --- a/crates/nu-cli/src/env/environment_syncer.rs +++ b/crates/nu-cli/src/env/environment_syncer.rs @@ -71,6 +71,7 @@ impl EnvironmentSyncer { } } } + } pub fn sync_path_vars(&mut self, ctx: &mut Context) {