Skip to content

Commit

Permalink
fix: remote oh-my-zsh env var export issue (topgrade-rs#528)
Browse files Browse the repository at this point in the history
* fix: fix remove oh-my-zsh env export issue
  • Loading branch information
SteveLauC authored Sep 19, 2023
1 parent 2a73aa7 commit ed8b563
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/steps/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,17 @@ pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> {
.args([
"-c",
// ` > /dev/null` is used in case the user's zshrc will have some stdout output.
format!("source {} > /dev/null && echo $ZSH", zshrc_path.display()).as_str(),
format!(
"source {} > /dev/null && export -p | grep ZSH > /dev/null && echo $ZSH",
zshrc_path.display()
)
.as_str(),
])
.output_checked_utf8()?;
env::set_var("ZSH", output.stdout.trim());
let zsh_env = output.stdout.trim();
if !zsh_env.is_empty() {
env::set_var("ZSH", zsh_env);
}
}

let oh_my_zsh = env::var("ZSH")
Expand Down

0 comments on commit ed8b563

Please sign in to comment.