Add add_nurc to sync_env command

This commit is contained in:
Sam Hedin 2020-06-04 01:16:07 +02:00
parent 3d15ac076c
commit 8eaaddca8f
2 changed files with 6 additions and 10 deletions

View File

@ -40,26 +40,23 @@ pub struct Environment {
impl Environment {
pub fn new() -> Environment {
let mut e = Environment {
Environment {
environment_vars: None,
path_vars: None,
};
e.add_nurc();
e
}
}
pub fn from_config<T: Conf>(configuration: &T) -> Environment {
let env = configuration.env();
let path = configuration.path();
let mut e = Environment {
Environment {
environment_vars: env,
path_vars: path,
};
e.add_nurc();
e
}
}
//Add env vars specified in the current dirs .nurc, if it exists.
pub fn add_nurc(&mut self) {
let key = "envtest";
let value = "I am here!";

View File

@ -44,6 +44,7 @@ impl EnvironmentSyncer {
pub fn sync_env_vars(&mut self, ctx: &mut Context) {
let mut environment = self.env.lock();
environment.add_nurc();
if environment.env().is_some() {
for (name, value) in ctx.with_host(|host| host.vars()) {
if name != "path" && name != "PATH" {
@ -70,8 +71,6 @@ impl EnvironmentSyncer {
}
}
}
environment.add_nurc();
}
pub fn sync_path_vars(&mut self, ctx: &mut Context) {