Skip to content

Commit

Permalink
Read env.sh locally but write env
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Jul 21, 2020
1 parent 9488dac commit a66e4e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.
To configure your current shell run `source {cargo_home}/env.sh`
To configure your current shell run `source {cargo_home}/env`
"
};
}
Expand All @@ -184,7 +184,7 @@ macro_rules! post_install_msg_unix_no_modify_path {
To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH`
environment variable.
To configure your current shell run `source {cargo_home}/env.sh`
To configure your current shell run `source {cargo_home}/env`
"
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/cli/self_update/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ pub trait UnixShell {
// Writes the relevant env file.
fn env_script(&self) -> ShellScript {
ShellScript {
name: "env.sh",
name: "env",
content: include_str!("env.sh"),
}
}

fn source_string(&self) -> Result<String> {
Ok(format!(r#"source "{}/env.sh""#, cargo_home_str()?))
Ok(format!(r#"source "{}/env""#, cargo_home_str()?))
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/cli-paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ source ~/fruit/punch
export PATH="$HOME/apple/bin"
"#;
const DEFAULT_EXPORT: &str = "export PATH=\"$HOME/.cargo/bin:$PATH\"\n";
const POSIX_SH: &str = "env.sh";
const POSIX_SH: &str = "env";

fn source(dir: impl Display, sh: impl Display) -> String {
format!("source \"{dir}/{sh}\"\n", dir = dir, sh = sh)
Expand All @@ -49,7 +49,7 @@ export PATH="$HOME/apple/bin"
// otherwise the literal path will be written to the file.

let mut cmd = clitools::cmd(config, "rustup-init", &INIT_NONE[1..]);
let files: Vec<PathBuf> = [".cargo/env.sh", ".profile", ".zshenv"]
let files: Vec<PathBuf> = [".cargo/env", ".profile", ".zshenv"]
.iter()
.map(|file| config.homedir.join(file))
.collect();
Expand Down Expand Up @@ -282,7 +282,7 @@ export PATH="$HOME/apple/bin"
assert!(cmd.output().unwrap().status.success());

let new_profile = fs::read_to_string(&profile).unwrap();
let expected = format!("{}source \"$HOME/.cargo/env.sh\"\n", FAKE_RC);
let expected = format!("{}source \"$HOME/.cargo/env\"\n", FAKE_RC);
assert_eq!(new_profile, expected);

let mut cmd = clitools::cmd(config, "rustup", &["self", "uninstall", "-y"]);
Expand Down

0 comments on commit a66e4e1

Please sign in to comment.