This commit is contained in:
Sam Hedin 2020-06-06 11:54:33 +02:00
parent c618538cf8
commit 4fdc3646e8
3 changed files with 3 additions and 34 deletions

View File

@ -1,7 +1,6 @@
use indexmap::IndexMap;
use nu_protocol::{Primitive, UntaggedValue, Value};
use std::io::Write;
use std::{ffi::OsString, fmt::Debug, fs::OpenOptions, path::PathBuf};
use std::{ffi::OsString, fmt::Debug, path::PathBuf};
#[derive(Debug, Default)]
pub struct DirectorySpecificEnvironment {

View File

@ -71,17 +71,6 @@ impl Environment {
Ok(())
}
fn remove_env(&mut self, key: &str) {
if let Some(Value {
value: UntaggedValue::Row(ref mut envs),
tag: _,
}) = self.environment_vars
{
envs.entries.remove(key);
std::env::remove_var(key);
};
}
pub fn morph<T: Conf>(&mut self, configuration: &T) {
self.environment_vars = configuration.env();
self.path_vars = configuration.path();

View File

@ -44,11 +44,6 @@ impl EnvironmentSyncer {
pub fn sync_env_vars(&mut self, ctx: &mut Context) {
let mut environment = self.env.lock();
// match environment.maintain_directory_environment() {
// Ok(_) => {}
// Err(e) => {panic!(e)}
// }
if environment.env().is_some() {
for (name, value) in ctx.with_host(|host| host.vars()) {
if name != "path" && name != "PATH" {
@ -57,22 +52,8 @@ impl EnvironmentSyncer {
environment.add_env(&name, &value, false);
environment
.direnv
.env_vars_to_add()
.unwrap()
.iter()
.for_each(|(k, v)| {
environment.add_env(&k, &v, true);
});
environment
.direnv
.overwritten_values_to_restore()
.unwrap()
.iter()
.for_each(|(k, v)| {
environment.add_env(&k, &v, true);
});
.maintain_directory_environment()
.expect("Could not set directory-based environment variables");
// clear the env var from the session
// we are about to replace them