Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/hooks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::cmd::cmd;
use crate::config::{Config, Settings, config_file};
use crate::shell::Shell;
use crate::tera::get_tera;
use crate::toolset::{ToolVersion, Toolset};
use crate::{dirs, hook_env};
use eyre::Result;
Expand Down Expand Up @@ -255,11 +256,15 @@ async fn execute(
Settings::get().ensure_experimental("hooks")?;
let shell = Settings::get().default_inline_shell()?;

let tera_ctx = ts.tera_ctx(config).await?;
let mut tera = get_tera(Some(root));
let rendered_script = tera.render_str(&hook.script, tera_ctx)?;
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated

let args = shell
.iter()
.skip(1)
.map(|s| s.as_str())
.chain(once(hook.script.as_str()))
.chain(once(rendered_script.as_str()))
.collect_vec();
// Preinstall hooks skip `tools=true` env directives since the tools
// providing those env vars aren't installed yet (fixes #6162)
Expand Down
10 changes: 5 additions & 5 deletions src/toolset/toolset_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ impl Toolset {
}
}

// Finish the global footer before running hooks so output isn't masked
if !opts.dry_run {
mpr.footer_finish();
}

// Skip hooks in dry-run mode
if !opts.dry_run {
// Run post-install hook with installed tools info
Expand All @@ -214,11 +219,6 @@ impl Toolset {
.await;
}

// Finish the global footer
if !opts.dry_run {
mpr.footer_finish();
}

// Return appropriate result
if all_failed.is_empty() {
Ok(installed)
Expand Down
Loading