Skip to content

Commit

Permalink
Fix an incorrect comparison in impl Zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Jul 17, 2020
1 parent e45a1ec commit 5454c34
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/cli/self_update/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl UnixShell for Bash {
}

fn rcfiles(&self) -> Vec<PathBuf> {
[".bash_profile", ".bash_login", ".profile", ".bashrc"]
[".bash_profile", ".bash_login", ".bashrc"]
.iter()
.filter_map(|rc| utils::home_dir().map(|dir| dir.join(rc)))
.collect()
Expand All @@ -153,16 +153,14 @@ impl Zsh {
Ok(dir) if dir.len() > 0 => Ok(PathBuf::from(dir)),
_ => bail!("Zsh setup failed."),
}
} else if utils::find_cmd(&["zsh"]) == Some("zsh") {
} else {
match std::process::Command::new("zsh")
.args(&["-c", "'echo $ZDOTDIR'"])
.output()
{
Ok(io) if io.stdout.len() > 0 => Ok(PathBuf::from(OsStr::from_bytes(&io.stdout))),
_ => bail!("Zsh setup failed."),
}
} else {
bail!("What? Unpossible.")
}
}
}
Expand Down Expand Up @@ -207,4 +205,4 @@ pub fn legacy_paths() -> impl Iterator<Item = PathBuf> {
.filter_map(|rc| utils::home_dir().map(|d| d.join(rc)));

profiles.chain(zprofiles)
}
}

0 comments on commit 5454c34

Please sign in to comment.